【发布时间】:2013-11-01 08:04:57
【问题描述】:
我的环境是: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>
然后我得到这个异常错误:
WARNING: org.apache.catalina.core.StandardHostValve@365f4aa6: Exception Processing ErrorPage[exceptionType=org.jboss.weld.context.NonexistentConversationException, location=/error.xhtml]
javax.servlet.ServletException: WELD-000321 No conversation found to restore for id 1
当我使用名为 ErrorHandler 的 Servlet 侦听器在 web.xml 中使用此代码捕获此异常时:
<error-page>
<exception-type>org.jboss.weld.context.NonexistentConversationException</exception-type>
<location>/ErrorHandler</location>
</error-page>
它工作正常,我正在从那里重定向到 error.xhtml。
我需要该位置直接通过 web.xml 工作(而不是通过 servlet)。
我尝试将 xhtml 页面更改为 html ,它仍然不起作用,但异常不同:
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
我也试过把位置的根改成/faces/error.xhtml,还是不行。
可能是什么问题?如何从 web.xml 重定向到页面?
提前致谢。
【问题讨论】:
标签: jsf-2 glassfish cdi web.xml weld