Define an array string in ActionForm [] SelectedOptions to store the value selected by the check box,
Array LabelValueBean [] PossibleOptions is used to display all values for all check boxes.
import org.apache.struts.util.LabelValueBean;... public class MyActionForm extends ActionForm {private LabelValueBean [] possibleOptions; private String [] selectedOptions; public MyActionForm () {// Initialise the LabelValueBeans in the possibleOptions array LabelValueBean []. Lvbeans = new labelvaluebean [4]; lvbeans [0] = new labelvaluebean ("alpha", "a"); lvbeans [1] = new labelvaluebean ("beta", "b"); lvbeans [2] = New labelValuebean "Charlie", "C"); lvBeans [3] = new LabelValueBean ( "Delta", "D"); this.possibleOptions = lvBeans;} public LabelValueBean [] getPossibleOptions () {return possibleOptions;} public String [] getSelectedOptions () {Return SELECTEDOPTIONS; PUBLIC VOID SetSelectedOptions (String [] SELECTEDOPTIONS = SELECTEDOptions;}}
Use the following code in JSP:
logic: Itereate>