Is there a way to ajax-update a specific component such as a <h:form>
in backing bean?
I tried the following using RequestContext#execute()
,
RequestContext context = RequestContext.getCurrentInstance();
context.execute("monitorVehicleForm.update()");
however that didn't seem to have any effect.
In order to updte the component from backing bean, we can achieve as below RequestContext.getCurrentInstance ().update ('updatePanelGroup'); Updating the component differs with respect to prima face version.
2. Re: refresh jsf component from backing bean Hi. Yes. I want to re-render them by AJAX. I have h:panelGrid with 2 components inside - h:outputText and p:rating (primefaces rating component).
Actually the component has a property for dynamically update of components. Unfortunately in the version I was using before there was a bug and these components were not updated. That is why I wanted to do some workaround.
The RequestContext is deprecated from Primefaces 6.2. From this version use the following: And to execute javascript from the backbean use this way: Show activity on this post. What I got to do is like having people that I iterate into a ui:repeat and display names and other fields in inputs.
The RequestContext#execute()
only executes arbitrary JavaScript code which is been passed-in as argument. It does not ajax-update the client representation of the components.
You need RequestContext#update()
instead wherein you just pass the client ID of the to-be-updated component.
context.update("monitorVehicleForm");
This has exactly the same effect as <p:commandXxx ... update="monitorVehicleForm">
. This works provided you've a
<h:form id="monitorVehicleForm">
without any NamingContainer
parent and thus have a
<form id="monitorVehicleForm" name="monitorVehicleForm" ...>
in the generated HTML.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With