0
我將JBoss EAP 6.1獨立使用於JSF 2.1.19,並將我的主機配置爲根上下文中的虛擬服務器。 (使用像/ myApp這樣的非根上下文,一切正常)。我試圖在使用Flash範圍重定向後顯示FacesContext信息消息。出於某種原因,我並不總是在第二頁上顯示Faces消息。有時候,有時候不會。有時會在第一頁顯示。JSF2和JBoss:當根虛擬主機指定時,Flash範圍內的消息不能存活重定向 - 獲取
這裏是我的JSF2豆:
@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";
}
}
相關firstPage.xhtml:
<h:form>
<h:commandButton value="ClickMe" action="#{testBean.submit()}"/>
</h:form>
相關secondPage.xhtml:
<h:body>
<h:messages id="globalMessages" globalOnly="true"/>
<h:link outcome="/firstPage" value="Back"/>
</h:body>
JBoss的standalone.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>
請幫幫忙!我完全沉迷於這一個。