如何让错误页面(HTTP 500)的工作ICEfaces的?错误、页面、工作、HTTP

2023-09-10 20:08:59 作者:说过走了之后就不在回头°

使用ICEfaces的2,如果执行一个操作方法在标准(=不ICEfaces的)H过程中出现错误:的commandButton,它只是似乎按钮没有作用。未显示错误页面,虽然它被配置为这样做在web.xml中。

Using Icefaces 2, if an error occurs during execution of an action method on a standard (=not icefaces) h:commandButton, it just seems the button has no action. No error page is displayed, although it is configured to do so in web.xml.

我可以使它工作由周围的标签

I can make it work by surrounding the tag with

<f:ajax disabled="true">...</f:ajax>

不过,我想无论是从ICEfaces的禁用该自动阿贾克斯(见问题如何禁用标准组件unsollicited阿贾克斯(H:的commandButton)在使用ICEfaces的?),或者使错误页面的工作呢。

But I'd want to either disable this automatic ajax from Icefaces (see question How to disable unsollicited ajax on standard components (h:commandButton) while using Icefaces? ), or make the error page work anyway.

JSF实现Mojarra 2.1里面自带的Glassfish 3.1。

JSF implementation is Mojarra 2.1 which comes with Glassfish 3.1.

推荐答案

最根本的问题是,ICEfaces的抓住了提交按钮,使阿贾克斯在里面。我觉得这简直是恶劣的行为:据我所知,这样的事情会发生在一个冰:的commandButton甚至在冰:形式,但它发生在H:命令按钮来H:形成为好。这可以被禁用,按 http://wiki.icefaces.org/display/ICE/Configuration < /一>,由autorender上下文参数设置为false,在web.xml中。但是,你需要明确地让每个ICEfaces的形式这种行为(否则你会得到一个错误)。

The basic problem is that Icefaces captures the submit button and puts ajax in it. I think this is simply bad behavior: I understand that something like that could happen in a ice:commandButton or even under ice:form, but it happens to h:commandButton to h:form as well. This can be disabled, as per http://wiki.icefaces.org/display/ICE/Configuration , by setting autorender context parameter to false in web.xml . But then, you need to explicitely enable this behavior on every icefaces form (you get an error otherwise).

总之,正如这里: http://wiki.icefaces.org/display/ ICE /处理+例外,将在页面这个脚本基本上解决了这个问题:

Anyway, as stated here: http://wiki.icefaces.org/display/ICE/Handling+Exceptions, putting this script in the page basically solves the problem:

                //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为它工作,见的http:// JIRA .icefaces.org /浏览/ ICE-6546 。我知道实现正常ICEfaces的行为显示与错误,这并没有发生弹出。

Update: I had to patch some Icefaces javascript for it to work, see http://jira.icefaces.org/browse/ICE-6546 . I know realize normal Icefaces behavior is displaying a popup with the error, which didn't happen.