它是一个监听器接口,它可以在Action完成控制处理之后,系统转入实际的物理视图之间被回调
public class LoginRegistAction
extends ActionSupport
{
...
public String execute() throws Exception
{
ActionInvocation invocation = ActionContext
.getContext().getActionInvocation();
invocation.addPreResultListener(new PreResultListener()
{
public void beforeResult(ActionInvocation invocation,
String resultCode)
{
System.out.println("返回的逻辑视图名字为:"
+ resultCode);
//在返回Result之前加入一个额外的数据。
invocation.getInvocationContext().put("extra"
, new java.util.Date() + "由"
+ resultCode + "逻辑视图名转入");
//也可加入日志等
}
});
}
...
}