日期:2014-05-19  浏览次数:20640 次

在线等,服务器错误,如何指定错误页面为jsp或action?
在项目中,想配置一个错误页面来解决服务器错误的提示,用struts2-2.1.6做控制,在web.xml中配置<error-page></error-page>指定静态的html就可以,指定为action或者jsp就不行,求解释.

------解决方案--------------------
看看的的web.xml中对strute的过滤器的url 是不是/* 如果是的话就是给过滤掉了。
XML code

...
    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>*.action</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
        <dispatcher>INCLUDE</dispatcher>
    </filter-mapping>
    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>*.jsp</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
        <dispatcher>INCLUDE</dispatcher>
    </filter-mapping>
...