开发者

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();
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜