JSF2 和 JBoss:当指定根虚拟主机时,Flash 范围的消息在重定向后无法存活



我正在将 JBoss EAP 6.1 与 JSF 2.1.19 独立使用,并将我的主机配置为根上下文中的虚拟服务器。 (使用像/myApp 这样的非根上下文,一切正常(。 我正在尝试在使用闪存范围重定向后显示 FacesContext 信息消息。 由于某种原因,我没有始终如一地在第二页上显示面孔消息。 有时有,有时没有。 有时它会重新出现在第一页上。

这是我的 JSF2 bean:

@ManagedBean
@RequestScoped
public class TestBean {
    public String submit() {
        System.out.println("...adding faces info message....");
        FacesContext.getCurrentInstance().getExternalContext().getFlash().setKeepMessages(true);
        FacesContext.getCurrentInstance().addMessage(null,new FacesMessage("Faces Info Message"));
        return "/second/secondPage?faces-redirect=true";
    }
}

相关首页.xhtml:

<h:form>
    <h:commandButton value="ClickMe" action="#{testBean.submit()}"/>
</h:form>

相关第二页.xhtml:

<h:body>
    <h:messages id="globalMessages" globalOnly="true"/>
    <h:link outcome="/firstPage" value="Back"/>
</h:body>

JBoss 独立.xml:

<subsystem xmlns="urn:jboss:domain:web:1.4" default-virtual-server="myApp" native="false">
    <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>
    <virtual-server name="myApp" enable-welcome-root="false" default-web-module="myApp">
        <alias name="localhost"/>
    </virtual-server>
</subsystem>

jboss-web.xml与myApp打包:

<jboss-web>
    <context-root>/</context-root>
    <virtual-host>myApp</virtual-host>
</jboss-web>

请帮忙! 我完全被这个难住了。

事实证明这是

JBoss 中的一个错误。 使用根上下文应用程序时,FacesMessages无法在重定向后获取中正确存活。在此提交: https://bugzilla.redhat.com/show_bug.cgi?id=1017242

相关内容

最新更新