struts2中的preresultlistner

  在struts2中,如果要在action执行完后,而RESULT还没有执行的时候,
做一些功能处理,就需要用preresultlistener.例子如下


  public class MyPreResult implements PreResultListener {
   public void beforeResult(ActionInvocation actionInvocation,String
result)
    {
............................
}

     }


然后在ACTION类的execute方法中,注册监听这个对象
     
public String execute() throws Exception {
 
      PreResultListener pr=new MyResult();
    ActionContext.getContext().getActionInvocation().addPreResultListener(pr);
     return this.SUCCESS;
}

posted @ 2012-02-20 15:06  sky7034  阅读(135)  评论(0编辑  收藏  举报
蘑菇街女装 货运专家