我正在使用总括库中的FullAjaxExeptionHandler,所有这些都运行得很好,但是我不知道如何在发生异常的页面上的PrimeFaces对话框中显示异常。目前,我只能将用户重定向到异常页面,就像总括展示中描述的那样。
我现在拥有的是:
<error-page>
<exception-type>java.lang.RuntimeException</exception-type>
<location>/errorpages/bug.xhtml</location>
</error-page>我想要的:
<error-page>
<exception-type>java.lang.RuntimeException</exception-type>
<location>/currentpage.xhtml?showExceptionDialog(exception)</location>
</error-page>谢谢。
发布于 2013-10-10 10:37:37
FullAjaxExceptionHandler不支持它。FullAjaxExceptionHandler被设计成实现完全相同的行为,就像它是一个非ajax请求一样。也就是说,按照标准Servlet使用web.xml指定的<error-page>条目。
而且,OmniFaces并不打算作为对特定PrimeFaces的扩展,因此不可能在FullAjaxExceptionHandler中使用任何PrimeFaces特定的API,如RequestContext或4.0“对话框框架”。这将使它无法在没有使用PrimeFaces的项目中使用,而是使用不同的组件库。
您最好的选择确实是创建自己的异常处理程序。只要您尊重Apache,您就可以完全自由地接管FullAjaxExceptionHandler的部分源代码。另一种方法是请求PrimeFaces扩展创建异常处理程序并将其添加到其标准集中。
https://stackoverflow.com/questions/19269352
复制相似问题