First, let's clarify a bit how Struts manages form submits:
- you submit some values using a HTML form to an action (in this case the action is a Struts action, usually *.do);
- Struts receives the requests because of the ActionServlet (specified in web.xml);
- based on the information you specified in your struts-config.xml file, a specific Action class is selected (the one matching your request);
- based on the identified Action an action form is obtained (again based on the info you specify in struts-config.xml);
- an instance of this ActionForm is created or recycled (based on the scope of the form: request vs session);
- data from the request is binded to the form properties;
- your action execute(...) method is called with this form object.
Now, binding is done based on name; name of the request parameter matching the name of the property in the form. The name of the request parameter is off course the name of an input field from the HTML form you submitted.
For example, if you submit an input with name test
, you should have the following accessors in your action form class (which respect JavaBeans convention for property named test
):
public void setTest(String val) { ... }
public String getTest() { ... }
If you have a list of values attached to the test
parameter (which I assume is your case since you mention a check box list) the accessors change to array type:
public void setTest(String[] val) { ... }
public String[] getTest() { ... }
But again the name is used for matching, always the name.
Not sure what you are trying to do with item 1 item 2. Are these the values that are submitted for your input (equivalent of test
)?