我在Struts 2项目中,简单的实现了一个异常类,然后再Action中抛出它,在struts.xml中这样配
<global-results>
<result name="login" type="redirect">/account/login</result>
<result name="exception">/error.jsp</result>
</global-results>
<global-exception-mappings>
<exception-mapping result="exception" exception="java.lang.Exception"/>
<exception-mapping result="exception" exception="com.zuwoba.exception.ProjectException"></exception-mapping>
</global-exception-mappings>
但是却无法跳转到error.jsp页面,这是怎么回事?
<global-results>
<result name="login" type="redirect">/account/login</result>
<result name="exception">/error.jsp</result>
</global-results>
<global-exception-mappings>
<exception-mapping result="exception" exception="java.lang.Exception"/>
<exception-mapping result="exception" exception="com.zuwoba.exception.ProjectException"></exception-mapping>
</global-exception-mappings>
但是却无法跳转到error.jsp页面,这是怎么回事?
第二,name="exception",exception换一个名称,如myexception试一试。也有可能是struts2 的关键字。查看一下日志,看是否有异常。或跳到哪个页面。都说一下。