Websphere Application Server 7下Apache Tiles 2.2的异常处理

来源:互联网 发布:收音机mac版 编辑:程序博客网 时间:2024/05/18 14:24

在Websphere Application Server 7下运行基于Apache Tiles 2.2的应用程序时, 在缺省配置下, 如果在一个子页中有异常发生, 相应的错误页只是显示在该子页中, 而其它子页则正常显示。 如果需要将整个页面重定向到错误页, 需要以下两个步骤:

1) 设置WAS应用服务器的custom propertycom.ibm.ws.webcontainer.dispatcherRethrowSErrortrue.该属性需要Fixpack 7.0.0.15, 见http://www-01.ibm.com/support/docview.wss?uid=swg1PM22919 和 http://pic.dhe.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=%2Fcom.ibm.websphere.express.doc%2Finfo%2Fexp%2Fae%2Frweb_custom_props.html.

2) 在Tiles的模板页中定义errorPage, 如下所示:

<%@ page errorPage="/jsp/general/error.jsp" %><%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %><tiles:insertAttribute name="header" /><tiles:insertAttribute name="body" /><tiles:insertAttribute name="footer" />