[creating a new thread so as not to hijack the
"ServletRedirectActionResult - is there a way to set parameters?"
thread]

Don Brown said:
>> The easiest solution is to simply return a
>> ServletActionRedirectResult instance from
>> your action method.

I've tried that myself as it seemed a very clean way of returning a
result, but I get a NullPointerException since the ActionMapper isn't
set on the Result. Now I could instead add:

@Inject
public void setActionMapper(ActionMapper actionMapper) { ... }

to my Action, then return a new ServletActionRedirectResult, but the
calling syntax gets a little messy. Here's an example method in the
Action class:

public Result submit() throws Exception {
        ServletActionRedirectResult result = new
                ServletActionRedirectResult("actionName").addParameter(
                "param1", "${value1}");
        result.setActionMapper(actionMapper);
        return result;
}

Can you think of any way that the actionMapper could be set
automatically on Result's which are instantiated inside of an Action? If
not, should I file this as a feature request?

p.s. for others reading this, this approach would imply not implementing
the Action interface's execute() method, since it must return a String.
Instead you can just define any zero-arg public method and it can return
either a String or a Result, and your URLs can use the
actionName!method.action style for referencing a particular method on
the Action.

Brad Cupit
Louisiana State University - UIS

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to