自己做的struts2异常测试:
jsp上<a href="**.action"/> ,action 里没有该跳转的方法,这时候报NoSuchMethod异常。
在struts.xml中加入
<global-results>
<result name="exceptionPage" type="redirect">
/jsp/tip/error.jsp
</result>
</global-results>
<global-exception-mappings>
<exception-mapping result="exceptionPage" exception="java.lang.Exception">
</exception-mapping>
</global-exception-mappings>
问题出现了,跳转到error页面后如何获得异常信息,控制台如何显示出异常信息?研究了好长时间了,还是不行。
问题补充
谢谢,原来是redirect的问题,把redirect去掉就行了
有一个是exception对象的记得,但是你用了redirect是不对的,应该得用默认那个吧,你自己再看看。不然看楼下有没朋友告诉你