2013-08-02 74 views
4

?cid=XX位於URL中時,我需要幫助處理過期/不存在的對話。我試圖把如何爲NonexistentConversationException配置錯誤頁面位置?

<error-page> 
    <exception-type>org.jboss.weld.context.ContextNotActiveException</exception-type> 
    <location>/faces/index.xhtml</location> 
</error-page> 
<error-page> 
    <exception-type>org.jboss.weld.context.NonexistentConversationException</exception-type> 
    <location>/faces/index.xhtml</location> 
</error-page> 

但是,這些沒有奏效。我仍然收到錯誤,無法轉發至index.xhtml。我怎麼解決這個問題?

回答

4

您必須明確指定不應傳播對於特定請求的對話。在index.xhtml的末尾添加nocid=true作爲參數。

<error-page> 
    <exception-type>org.jboss.weld.context.NonexistentConversationException</exception-type> 
    <location>/faces/index.xhtml?nocid=true</location> 
</error-page> 

請參考以下鏈接 expired conversations involving CDI and JSF

1

的祖先焊縫例外在web.xml中的工作原理:

<error-page> 
    <exception-type>javax.enterprise.context.NonexistentConversationException</exception-type> 
    <location>/index.xhtml?nocid=true</location> 
</error-page>