标签:
1. UsersDAO.java里产生一个例外:
System.out.println(1/0);
2. 调用DAO的UsersAction1.java 的execute方法, 加抛异常:
public String execute() throws Exception
3. struts.xml配置,
<global-results> <result name="login_success">/login_success.jsp</result> <result name="login_failure">/login_failure.jsp</result> <result name="error">/error.jsp</result> </global-results>
<global-exception-mappings>
<exception-mapping result="error" exception="java.lang.Exception"></exception-mapping>
</global-exception-mappings>
4. error.jsp显示错误信息:
<br><s:property value="exception"/>
最后运行结果是, 即便输入的正确的用户名和密码也会显示出错信息
标签:
原文地址:http://www.cnblogs.com/wujixing/p/5190213.html