How to pass Spring MVC form <form:select> selected value to Spring webflow action class

291 Views Asked by At

I am using Spring MVC v4.3.12 and Spring WebFlow v2.4.4. I have problems to use form:select drop down menu pass the value back to WebFlow action class. The bean I am using is:

public class Application{
    products = new LinkedHashMap<String, String>();

public Map<String, String> getProducts() {
    return products;
}

/**
 * @param products The products to set.
 */
public void setProducts(final Map<String, String> products) {
    this.products = products;
}

In Webflow action class, The bean class have been set like this:

public class SomeAction extends FormAction {

    public SomeAction() {
        super();
        setFormObjectName("application");
        setFormObjectClass(Application.class);
        setFormObjectScope(ScopeType.CONVERSATION);
    }

I also set the model/bean in WebFlow config file

<view-state id="someSelect" model="application" view="SomeSelect">

The problem is when I try to set the select:form path in jsp, the selected value of the dropdown never passed back to WebFlow action class. the jsp page:

<form:select path="${application.products.value}">
      <form:option value="0" label="0"/>
      <c:forEach begin="1" end="${applicationScope.MAX_VALUE}" varStatus="quantity">
        <form:option value="${quantity.index}"></form:option>
      </c:forEach>
    </form:select>

I want pass the selected dropdown value back to WebFlow Action class as the second String in the products LinkedHashMap. How do I set the path for <form:select tag?

Thank you for your help.

0

There are 0 best solutions below