Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jsf 2 会话通过web.xml过期后,将用户重定向到错误页(xhtml)_Jsf 2_Glassfish_Cdi_Web.xml_Weld - Fatal编程技术网

Jsf 2 会话通过web.xml过期后,将用户重定向到错误页(xhtml)

Jsf 2 会话通过web.xml过期后,将用户重定向到错误页(xhtml),jsf-2,glassfish,cdi,web.xml,weld,Jsf 2,Glassfish,Cdi,Web.xml,Weld,我的环境是:NetBeans7.2.1、GlassFish3.1、JSF2和Weld 1.1.0 当对话时间到期时,我想重定向到error.xhtml页面。 在web.xml中,我添加了以下代码: <error-page> <exception-type>org.jboss.weld.context.NonexistentConversationException</exception-type> <location>/error.

我的环境是:NetBeans7.2.1、GlassFish3.1、JSF2和Weld 1.1.0

当对话时间到期时,我想重定向到error.xhtml页面。 在web.xml中,我添加了以下代码:

<error-page>
    <exception-type>org.jboss.weld.context.NonexistentConversationException</exception-type>
    <location>/error.xhtml</location>
</error-page>
当我使用名为ErrorHandler的Servlet侦听器在web.xml中使用以下代码捕获此异常时:

<error-page>
    <exception-type>org.jboss.weld.context.NonexistentConversationException</exception-type>
    <location>/ErrorHandler</location>
</error-page>
我还尝试将位置的根目录更改为
/faces/error.xhtml
,但仍然不起作用

有什么问题吗?如何从web.xml重定向到页面


谢谢,这是事先准备好的

您需要将
nocid
参数添加到URL,因为出现错误的原因是CDI正在将不存在的会话id发送到
error.xhtml
页面。所以试试下面的方法

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

org.jboss.weld.context.NonexistentConversationException
/错误。xhtml?nocid=true

更多信息

这是错误:
警告:StandardWrapperValve[Faces Servlet]:PWC1406:Servlet.service()用于Servlet Faces Servlet引发异常org.jboss.weld.context.NoexistentConversationException:weld-000321未找到id 1的要还原的会话
哇,那么我不知道,这正是
nocid
param应该防止的,即使
出错。xhtml
不使用对话?你知道这是什么原因吗?它似乎找不到页面,我不知道为什么。。。。。
WARNING: StandardWrapperValve[Faces Servlet]: PWC1406: Servlet.service() for servlet Faces     Servlet threw exception
 org.jboss.weld.context.NonexistentConversationException: WELD-000321 No conversation found to restore for id 1
<error-page>
    <exception-type>org.jboss.weld.context.NonexistentConversationException</exception-type>
    <location>/error.xhtml?nocid=true</location>
</error-page>