Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

PreResultListener is provided to allow alteration / cause influence on a particular action invocation (eg. maybe its Result object, switching to a different result, the Action object itself etc) before the Result is being executed. This could be done at the Action object or at the Interceptor itself.

...

Examples

Action object

Code Block
  public class MyAction extends ActionSupport {
     ...
     public String execute() throws Exception {
         ActionInvocation invocation = ActionContext.getActionInvocation();
         invocation.addPreResultListener(new PreResultListener() {
              public void beforeResult(ActionInvocation invocation, 
                                       String resultCode) {
                  // perform operation necessary before Result execution
              }
         });
     }
     ...
  }

...