【问题标题】:NonexistentConversationException passes cid parameter to error-page which causes the error page to failNonexistentConversationException 将 cid 参数传递给 error-page 导致错误页面失败
【发布时间】:2012-10-10 09:45:22
【问题描述】:

我正在使用@ConvertationScoped bean,我想为您手动更改 cid 参数的情况创建一个很好的错误页面。

    <error-page>
    <exception-type>javax.enterprise.context.NonexistentConversationException</exception-type>
    <location>/nonExistentConversation.xhtml</location>
</error-page>
<error-page>
    <exception-type>org.jboss.weld.context.NonexistentConversationException</exception-type>
    <location>/nonExistentConversation.xhtml</location>
</error-page>

问题是cid参数传给了错误页面,而这些错误页面也因为找不到对话而失败,导致进入默认异常页面。

这个问题的最佳解决方案是什么?创建过滤器、自定义处理程序等?

【问题讨论】:

    标签: jsf-2 cdi


    【解决方案1】:

    Atm 我正在为我的对话错误页面使用非 jsf 页面。

    我的 web.xml 中有这个:

    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.xhtml</url-pattern>
    </servlet-mapping>
    

    所以名为 error.html 的页面不会通过 Faces Servlet,并且错误页面将显示为 iso 搜索请求参数中带有 cid 的对话。

    缺点是你不能在其中做任何 JSF 的东西(i18n,dev 中的堆栈跟踪,..)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-10
      • 1970-01-01
      • 1970-01-01
      • 2014-07-06
      相关资源
      最近更新 更多