如何从辅助bean刷新整个JSF页面 [英] How to refresh entire JSF page from the backing bean

查看:148
本文介绍了如何从辅助bean刷新整个JSF页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在JSF页面上有一个rich:comboBox,它有一个valueChangeListener,它调用一个支持bean函数:

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>

这里是valueChangeListener支持bean函数:

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

我们如何让这个函数重新加载具有rich的JSF页面: comboBox?

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

感谢您的帮助。

推荐答案

您可以使用< a4j:support> oncomplete 属性与JS一起强制重页加载,如果那是你的话想做,比如:

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)"/>

这篇关于如何从辅助bean刷新整个JSF页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆