请教:(Struts2)在将Global Exception Redirect到一个Action后,如何在Action中获取该Exception

我们知道在struts.xml中增加global-exceptions配置可以将未捕捉的异常指向一个result,且该result可显示一个jsp页面,在jsp页面中用等可以显示该异常消息。
但是因为我希望在显示异常前做一些额外处理,比如发送Email通知维护人员。所以我将result redirect到一个Action中,但是如何在该Action中获得捕捉到的异常?
我使用了:
1. ActionContext.getContext().getValueStack().findValue("exception");
2. ActionContext.getContext().getParameters.get("exception");
3. ActionContext.getContext().get.....
等等方法都无法获得该Exception.

请教大家了~~

你不用redirect 用chain 类型的action,chain类型可以把栈中的值也传递过去。
这样能够把发生的异常传递到你指定的类,在做处理。试一试。具体那就要你自己实现了。

[quote]1. ActionContext.getContext().getValueStack().findValue("exception"); [/quote]

曾经也试过,没试出来

[quote]你不用redirect 用chain 类型的action,chain类型可以把栈中的值也传递过去。
这样能够把发生的异常传递到你指定的类,在做处理。试一试。具体那就要你自己实现了。[/quote]

good idea :idea: