Java 如何使错误页面(http 500)在IceFaces中工作?
使用Icefaces 2,如果在标准(=非Icefaces)h:commandButton上执行操作方法时发生错误,则该按钮似乎没有任何操作。虽然在web.xml中配置为显示错误页面,但不会显示错误页面 我可以通过在标签周围使用Java 如何使错误页面(http 500)在IceFaces中工作?,java,ajax,jsf,jsf-2,icefaces,Java,Ajax,Jsf,Jsf 2,Icefaces,使用Icefaces 2,如果在标准(=非Icefaces)h:commandButton上执行操作方法时发生错误,则该按钮似乎没有任何操作。虽然在web.xml中配置为显示错误页面,但不会显示错误页面 我可以通过在标签周围使用 <f:ajax disabled="true">...</f:ajax> 。。。 但是我想从Icefaces中禁用这个自动ajax(请参见问题),或者让错误页面正常工作 JSF实现是Glassfish 3.1附带的Mojarra 2.1。基本
<f:ajax disabled="true">...</f:ajax>
。。。
但是我想从Icefaces中禁用这个自动ajax(请参见问题),或者让错误页面正常工作
JSF实现是Glassfish 3.1附带的Mojarra 2.1。基本问题是Icefaces捕获提交按钮并将ajax放入其中。我认为这只是一种不好的行为:我知道类似的事情可能发生在冰:commandButton中,甚至在冰:form下,但它也发生在h:commandButton到h:form之间。通过在web.xml中将autorender上下文参数设置为false,可以根据禁用该选项。但是,您需要在每个icefaces表单上明确地启用此行为(否则会出现错误) 无论如何,正如这里所述:,将此脚本放入页面基本上解决了问题:
//Assign your error handling function to a variable
var iceErrorCallback = function iceHandleError(statusCode, responseTxt, responseDOM) {
//Handle all errors by simply redirecting to an error page
window.location.href = "./generalError.xhtml";
}
//Safely check if ICEfaces is available
if (ice) {
//Turn off the popups as we plan to handle this ourselves
ice.configuration.disableDefaultIndicators = true;
//Register your error handler as a callback
ice.onServerError(iceErrorCallback);
}
更新:我必须修补一些Icefaces javascript才能让它工作,请参阅。我知道Icefaces的正常行为是显示一个带有错误的弹出窗口,但这并没有发生