1.在web.xml
<error-page>
<error-code>404</error-code>
<location>/error.jsp</location>
</error-page>
2.在struts.xml
<global-results>
<result name="error" >/error.jsp</result>
</global-results>
<global-exception-mappings>
<exception-mapping result="error" exception="java.lang.Exception"></exception-mapping>
</global-exception-mappings>
<action name="notFound">
<result>/error.jsp</result>
</action>
有错误页面转到error.jsp,同时控制台不打印,注意把开发模式关闭