How is the TestForm(boolean) constructor being invoked?  The Struts framework will 
simply invoke the default constructor.

How are you "setting the selected string array in Action class"?  Are you creating 
this form bean in the Action class then setting the array?  If so, are you persisting 
this form bean to some scope (request/session/application)?  If you don't and if the 
Struts framework doesn't find one in some scope it'll simply create one -- by calling 
the default constructor.

Sri

-----Original Message-----
From: sanjana [mailto:sanjana@;strandgenomics.com] 
Sent: Friday, October 25, 2002 5:17 AM
To: [EMAIL PROTECTED]
Subject: multibox : problem with preselected array


Hi,
 
I have been trying to use multibox and am facing a strange problem. I want a few 
values to be preselected when I load the form. If I initialize my selected string 
array in default constructor of the form then 
everything works properly and I can see those checkboxes as selected when the form 
loads. On the other hand if the selected string array is populated in an overloaded 
constructor then no checkbox is selected ?????? Even setting the selected string array 
in Action class doesn't help :-(
 
Anyone........ where am I going wrong ? 
______________________________________
The form has :
 
 private String[] selectedItems;
 private String[] items;
 
 public void reset(ActionMapping mapping,
                  javax.servlet.http.HttpServletRequest request) {
  selectedItems = new String[0];
 }
 
 public TestForm(boolean flag)
 {
  if(flag)
  {
   selectedItems = new String[1];
   selectedItems[0] = "FedEx";
   items = new String[3];
   items[0] = "FedEx";
   items[1] = "UPS";
   items[2] = "Airborne";
  }
 }
 
 and the corresponding getter ad setter methods.

the jsp has the following code :

<logic:iterate id="item" name="f" property="items">
  <html:multibox property="selectedItems">
   <bean:write name="item"/> 
  </html:multibox> 
   <bean:write name="item"/> 
</logic:iterate>


Thanks,
Sanjana
 

--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org>

Reply via email to