如何使错误页面(http 500)在 IceFaces 中工作?
使用 Icefaces 2,如果在标准(=非icefaces)h:commandButton 上执行操作方法期间发生错误,则该按钮似乎没有任何操作。尽管在 web.xml 中将其配置为显示错误页面,但不会显示错误页面。
我可以通过使用
<f:ajax disabled="true">...</f:ajax>
但我想从 Icefaces 禁用此自动 ajax 来使其工作(请参阅问题 如何禁用未经请求的 ajax使用 Icefaces 时使用标准组件 (h:commandButton)? ),或者让错误页面正常工作。
JSF 实现是 Mojarra 2.1,它随 Glassfish 3.1 一起提供。
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>
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 implementation is Mojarra 2.1 which comes with Glassfish 3.1.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
基本问题是 Icefaces 捕获提交按钮并将 ajax 放入其中。我认为这只是不好的行为:我知道类似的事情可能发生在ice:commandButton中甚至在ice:form下,但它也发生在h:commandButton到h:form上。可以根据 http://wiki.icefaces.org/display/ICE/Configuration< 禁用此功能/a> ,通过在 web.xml 中将自动渲染上下文参数设置为 false 。但是,您需要在每个icefaces 表单上明确启用此行为(否则您会收到错误)。
无论如何,如下所述: http://wiki.icefaces.org/display/ICE/Handling +异常,将此脚本放在页面中基本上可以解决问题:
更新:我必须修补一些 Icefaces javascript 才能使其正常工作,请参阅 http://jira.icefaces.org/browse/ICE-6546 。我知道 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).
Anyway, as stated here: http://wiki.icefaces.org/display/ICE/Handling+Exceptions, putting this script in the page basically solves the problem:
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.