How to design a page in struts using CheckBox for choosing 2 or more values?
Perform the following steps:
1. Action Form: Design a form with Array of Objects of String type.
String[] selectedValues = { };
2. JSP: Populate the values that it can hold using logic:iterate tag.
<html:checkBox .... property="selectedValues" value="<%=obj[i].getValue()%>" ..... >
3. After Form submission: the selected values will be placed in selectedValues property
4. Now, in Action, iterate the collection, to identify the selected DTO object.
This needs to be designed as per the requirements.
For example, based on 'selectedValues', pick up the selected objects from the one collection into another,
so that the business routine can use the resultant collection.
Have Fun...
Saturday, March 28, 2009
Subscribe to:
Posts (Atom)