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 p:poll阻止导航到自定义ExceptionHandler中的页面_Jsf 2_Primefaces_Jboss7.x_Facelets - Fatal编程技术网

Jsf 2 p:poll阻止导航到自定义ExceptionHandler中的页面

Jsf 2 p:poll阻止导航到自定义ExceptionHandler中的页面,jsf-2,primefaces,jboss7.x,facelets,Jsf 2,Primefaces,Jboss7.x,Facelets,我已经编写了自己的JSF处理程序,从ExceptionHandlerWrapper派生它。在handle方法中,我有以下代码: NavigationHandler navigationHandler = fc.getApplication().getNavigationHandler(); navigationHandler.handleNavigation(fc, null, "error"); fc.renderResponse(); 问题在于,在具有primefaces轮询元素的页面上:

我已经编写了自己的JSF处理程序,从ExceptionHandlerWrapper派生它。在handle方法中,我有以下代码:

NavigationHandler navigationHandler = fc.getApplication().getNavigationHandler();
navigationHandler.handleNavigation(fc, null, "error");
fc.renderResponse();
问题在于,在具有primefaces轮询元素的页面上:

<p:poll ajax="true" interval="10" widgetVar="pollPing" autoStart="false" oncomplete="remoteCommandPing()"/>
但我得到的只是:

XML Parsing Error: no element found
这意味着服务器响应为空(显然是因为extCtx.responseReset();),之后不会重定向到错误页


是否有人知道如何简单地停止所有请求并强制重定向到某些面管理页面?我尝试了各种解决方案,包括setViewRoot和OminFaces的FullAjaxExceptionHandler.java中的一些代码片段,但没有成功。谢谢。

您可以用try-catch来包围java代码,并在catch块中执行以下操作:

FacesContext.getCurrentInstance().getExternalContext().redirect("foo.xhtml");

Id这并不能回答您的问题您可能需要提供更多代码,并尝试更好地解释您的问题

这并不是我所需要的,但将答案标记为正确,因为这是我最后必须使用的。
FacesContext.getCurrentInstance().getExternalContext().redirect("foo.xhtml");