Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Struts and the fly likes Multibox Not Populating as Checked!!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Multibox Not Populating as Checked!!!" Watch "Multibox Not Populating as Checked!!!" New topic

Multibox Not Populating as Checked!!!

suvendu patra

Joined: Nov 19, 2002
Posts: 5
Hi All,
Has anybody got any idea about multibox, how to make it checked while displaying.
1) this is my iterate logic
<logic:iterate id="Org" name="hmTemp">
<html:multibox property = "hmOrg">
<bean:write name="Org" property="key"/>
<bean:write name="Org" property="value"/>
i have an ActionForm which has getter & setter method as follows: for "hmOrg"
public HashMap getHmOrg() {
return this.hmOrg;
public void setHmOrg(HashMap values) {
this.hmOrg = values;
am calling hmOrg and setting the values in the bean, but its not populating for the selected checkboxes.

Thanks in Advance
Darryl A. J. Staflund
Ranch Hand

Joined: Oct 06, 2002
Posts: 303
Hi there,
You need to prepopulate your action form in one action before handing it to another action for rendering in the browser.
For instance, assume you are create an 'Edit <xxx>' tool of some kind and some of the information to be modified contains populated checkboxes. In order to execute this command, you have to do something like the following:
1. Execute the 'prepopulateEditXXXForm' Action class.
2. Execute the 'editXXX' Action class.
3. Execute the 'processEditXXXForm' Action class.
These actions, if executed in order would: (i) populate the edit form with data before it is displayed on the screen; (ii) render the pre-populated form on the screen; and (iii) process the results of the editing.
If Step 1 is missed, then the action form's values will be reset to their default values before the form is displayed. It sounds as though this is what's happening in your example.
I agree. Here's the link:
subject: Multibox Not Populating as Checked!!!
It's not a secret anymore!