I was explaining to a colleague the way of getting list data from a JSP page to back to the action class by using indices as explained here and here. He didn't quite understand and fumbled a bit on his own until he suddenly he made it work by not using indices at all!
In his JSP page he had:
<input type="checkbox" name="contactNameList" value="someValue1">
<input type="checkbox" name="contactNameList" value="someValue2">
<input type="checkbox" name="contactNameList" value="someValue3">
<input type="checkbox" name="contactNameList" value="someValue4">
public List<String> getContactNameList()
public void setContactNameList(List<String> list)
You should understand that bean data and not bean data are passed as parameters to the action. The parameters has a structure that you can find if you implement
Note that all parameter values for a given name will be returned, so the type of the objects in the map is
Then XWork Type Conversion make its best to convert this map to beans properties. See Built in Type Conversion Support.
Routine type conversion in the framework is transparent. Generally, all you need to do is ensure that HTML inputs have names that can be used in OGNL expressions. (HTML inputs are form elements and other GET/POST parameters.)
In the no indexes case parameters are mapped under the one key, rather than indexed names are used under their own names.