Spring Web Flow actions

Published: Saturday, 7 October 2006

How to Create a New Action

Extend MultiAction then make sure your signature returns an Event, and accepts a RequestContext as a parameter.

The following example is a very basic action that returns “start” every time.

public class StartAction extends MultiAction {
    public Event start(RequestContext context) throws Exception {
        Event start = new Event(this, "start");
        return start;
    }
}

Accessing Request Parameters

To access to the normal Servlet Request parameters you may be used to use the following code

public Event exampleEvent(RequestContext context) throws Exception {
    ExternalContext externalContext = context.getExternalContext();
    ParameterMap requestParameterMap = externalContext.getRequestParameterMap();