在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,
美妙的异常提示页面,出现了!