JSF NavigationHandler#handleNavigation + clear cache
A button on page xyz.xhtml does invoke this code (using ajax).
FacesContext fc = FacesContext.getCurrentInstance();
NavigationHandler nh = fc.getApplication().getNavigationHandler();
nh.handleNavigation(fc, null, 开发者_Python百科"home");
home points to abc.xhtml. This page contains a table which should be refreshed but this does not happen. Any idea?
How can I refresh without using own JavaScript? I've got a workaround using onload attribute and JavaScript which reloads table using ajax. But this does "flatter" screen. This solution is not sophisticated.
I am using JSF 2, OpenFaces 3 and IE8.
Thank you in advance!
I don't understand why you're fiddling with the navigation handler like that. I'm not sure about the OpenFaces part since I've never used it, so here's just a basic JSF 2.x approach with <f:ajax>
to give the basic idea of how it should actually be done:
<h:form>
<h:commandButton value="refresh" action="#{bean.refresh}">
<f:ajax render=":table" />
</h:commandButton>
</h:form>
<h:dataTable id="table" value="#{bean.list}" var="item">
...
</h:dataTable>
with
public void refresh() {
list = someService.list();
}
精彩评论