Ajax Update All components with JSF
Is there a way to update all components or do I have to manually se开发者_如何学Clect each id? I have an ajax html5 detection script and dont want have to update every component via the id.
Thanks
Just use the ID of the common parent component.
<h:panelGroup id="someParent">
<h:someComponentToUpdate ... />
...
<h:someComponentToUpdate ... />
...
<h:someComponentToUpdate ... />
...
</h:panelGroup>
...
<f:ajax render="someParent" />
Or use @all
to refresh the entire page.
<f:ajax render="@all" />
If you need to invoke an update base on an event, I would recommend you use PrimeFaces. Check out their showcase at http://www.primefaces.org/showcase-labs/ui/home.jsf. Below show how to use update components when a button is click
<p:commandButton value="Test" update="container" actionListener="#{myBean.process}"/>
Then have a wrapper container wrap around all components that you want to update like BalusC shows above.
<h:panelGroup id="container">
...
// All components you want to update here.
</h:panelGroup>
精彩评论