在struts.xml中配置了异常跳转,

    <package name="default" namespace="/" extends="struts-default">
        <global-results>
            <result name="exception-error">/error/exception.jsp</result>
        </global-results>
        <global-exception-mappings>
            <exception-mapping result="exception-error" exception="java.lang.Exception"></exception-mapping>
        </global-exception-mappings>    
    </package>

 

其他的action都继承default。

但是,当url输错的时候,页面依然会出现很多异常信息,并没有按照预期跳转至编写的exception错误提示页。

 

纠结了一阵子后,发现是这里的问题:struts.xml中的配置:

 

    <!--开发模式下使用,这样可以打印出更详细的错误信息-->
    <constant name="struts.devMode" value="true" />

 

    将true改为false,

    美妙的异常提示页面,出现了!

相关文章:

  • 2021-07-02
  • 2022-12-23
  • 2021-10-12
  • 2021-06-04
  • 2021-12-30
  • 2021-04-09
  • 2021-06-20
  • 2021-10-16
猜你喜欢
  • 2021-04-30
  • 2022-12-23
  • 2021-11-23
  • 2022-12-23
  • 2021-11-02
相关资源
相似解决方案