I've not worked with that feature, but I'd have thought it would be like the other controls - you preset the default value in the Form Bean's reset method with an option to override it in the Action code before it goes out. Also, if the fields have the same name, I'd consider using Strut's ability to use indexing on names - an amenity straight HTML doesn't offer.
"privilege" comes from the Latin words for "private" and "law" (legal) and dates to feudal times. To "claim privilege" meant that you were above the laws that applied to the common people.
posted 17 years ago
You can treat it like other controls and preset the values in the reset method and override it in the Action method. But the key is in how HTML treats checkboxes. The way HTML would process checkboxes is that it sends in the parameter and a value *only* if it is checked. E.g say you had a form with textbox name=text1 checkbox name=check1 value="abc". OnSubmit Button = someAction.do. Case 1. text in text1 ="sss" check1=checked OnSubmit would generate SomeAction.do?text1=abc&check1=abc Case 2. text in text1 ="" check1= not checked OnSubmit would generate SomeAction.do?text1= Note that it dosen't send in the check1 parameter. You could have multiple checkboxes in HTML having the same name. It would just repeat the values in the URL. Say you had 3 checkboxes all named check1 with value=1,2,3. Assume all 3 are checked On form submit you would have this URL generated. -SomeAction.do?check1=1&check1=2&check1=3 If only the first 2 were checked the URL would be -SomeAction.do?check1=1&check1=2 and so on. Struts just collects these and puts it into an array. On the view sides it compares the values in the array to the values of the boxes and checks the appropriate boxes. HTH Ravi