Versions Compared

Key

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

...

You can always extend defined result types and implement whatever logic you need. To simplify process of that, you can define you your custom ResultBuilder ResultFactory and use it with connection with custom interface which your Result implements. Check Define dedicated builderfactory to see how to do it.

Struts 2 provides one such extension for you: ParamNameAwareResult interface when used with StrutsResultBuilder can limit parameters assigned to the result. So you can simple extend existing result with such a functionality as below:

Code Block
java
java
public class MyResult extends ServletDispatcherResult implements ParamNameAwareResult {

    public boolean acceptParamNameacceptableParamName(String name, String value) {
        return "accept".equals(name);
    }

}

...