views:

246

answers:

2

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

<rich:comboBox id="cbmodel" defaultLabel="${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.

+1  A: 

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" />
Vivien Barousse
+1  A: 

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)"/>
StudiousJoseph
This is exactly what I was looking for. Thanks!
droidy