dynamic number of Multiboxes
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Lawrence_Williams
Posted On:   Thursday, February 19, 2004 08:44 AM

Hi, I have an issues with dynamic multiboxes. - I don’t know how many multibox sets I will need on my form (i.e. it has to have a dynamic number of multiboxes, each with a dynamic number of name/value pairs) until runtime. At present i use an ActionForm subclass uses: private java.util.ArrayList attributeValues = new java.util.ArrayList(); private java.util.ArrayList attributeStatus = new java.util.ArrayList(); to store the possible values and 'check status'. The ArrayLists each hold LabelValueBean[] and String[] respectively. This allows me to display a variable number of multiboxes as follows:    More>>

Hi,



I have an issues with dynamic multiboxes. - I don’t know how many multibox sets I will need on my form (i.e. it has to have a dynamic number of multiboxes, each with a dynamic number of name/value pairs) until runtime.



At present i use an ActionForm subclass uses:



			
private java.util.ArrayList attributeValues = new java.util.ArrayList();
private java.util.ArrayList attributeStatus = new java.util.ArrayList();


to store the possible values and 'check status'. The ArrayLists each hold LabelValueBean[] and String[] respectively.



This allows me to display a variable number of multiboxes as follows:



			







${valuePairs.value}

${valuePairs.label}






This generates html:



			


Size



S
M
L

Colour



Black
White








So the display works fine - I just cant work out what setters in need in my form subsclass. The best I can get is a single value for each multibox being passed using:



			

public void setAttributeStatus(int i, Object in){
this.attributeStatus.set(i,in);
}


Any ideas?

   <<Less

Re: dynamic number of Multiboxes

Posted By:   Raj_Natarajan  
Posted On:   Friday, February 20, 2004 10:51 AM

This tag would be in an iterate tag





html:multibox property="departmentOptions" >



This will generate





td class="row-cell">/td





td class="row-cell">/td




etc




This will be in the form for the jsp




private String[] departmentOptions = null;




In the reset method




departmentOptions = new String[0];




In the action class that sets up the jsp





f.getDepartmentOptions()[i]=new Integer(deptOptions[i].getOptionDetailId()).toString();




which will check on or off the checkbox




Hope this helps!
About | Sitemap | Contact