开发者

How to refresh entire JSF page from the backing bean

We have a rich:comboBox on a JSF page which has a valueChangeListener that calls a backing bean function:

<rich:comboBox id="cbmodel" d开发者_开发百科efaultLabel="${accessUtils.activeRole}" value="${accessUtils.activeRole}" 
 style="float: right;" valueChangeListener="${accessUtils.valueChangeListener}" >
   <c:forEach var="role" items="${accessUtils.currentUserRoles}"> 
    <f:selectItem itemValue="#{role}"/>
    <a4j:support event="onchange" ajaxSingle="false" />

</c:forEach>
</rich:comboBox>

And here's the valueChangeListener backing bean function:

public void valueChangeListener(ValueChangeEvent event){  
System.out.println("EVENT: HAS BEEN CALLED " + event.getNewValue());  
    setActiveRole((String) event.getNewValue());
}

How can we get this function to reload the JSF page which has the rich:comboBox?

Thanks for any help.


You could use the oncomplete attribute of the <a4j:support> with JS to force a full page reload, if that's what you want to do, like:

<a4j:support event="onchange" ajaxSingle="false" oncomplete="javascript:location.reload(true)"/>


a4j:support contains an optional reRender attribute that can force a JSF component to reload after invoking the JSF listener.

You can try with:

<a4j:support event="onchange" ajaxSingle="false" reRender="myComp" />
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜