I'm just learning here as well.....but that is what worked for me.   I actually store 
the vectors in a CollectionForm with the two vectors as members.  I don't know if this 
was the most graceful way to handle the problem, but it worked for me.  I have 
something like this:

I used a CollectionForm for the same purpose as you would like to.  I have several 
drop-down selections so I just create a CollectionForm object for each, and populate 
the labels and values from my business object, which I'm sure you have done already.

also, for state management, the collectionForms are stored in a transaction to be 
re-used during the same session.  This way I can grab them for any action where I need 
the same drop-down list.   

public class CollectionForm   implements Serializable {
    private Vector labels;
    private Vector values;

...

public class IncidentForm extends ActionForm implements Serializable {
public Vector getUnsafeLabels(){
        return CollectionForm.getLabels();
        
    }

    public Vector getUnsafeValues(){
        return CollectionForm.getValues();
       
    }
...



-----Original Message-----
From: Abhinav (Cognizant) [mailto:[EMAIL PROTECTED]
Sent: Tuesday, May 27, 2003 11:49 AM
To: Struts Users Mailing List
Subject: RE: html:select / html:options


That means we are keeping unsafeValues and unsafeLabels separately in our form-bean. 
(Though they are related -- i think so)
What if these two are kept encapsulated in an object.

-----Original Message-----
From: Kandi Potter [mailto:[EMAIL PROTECTED]
Sent: Tuesday, May 27, 2003 9:06 PM
To: Struts Users Mailing List
Subject: RE: html:select / html:options


I used the following with vectors of unsafeValues and unsafeLabels in my incidentForm 
bean.



<html:select  name="incidentForm"  property="selectedUnsafe"  >
    <html:option value="">&nbsp</html:option>
    <html:options name="incidentForm" property="unsafeValues"  
labelName="incidentForm"                                                         
labelProperty="unsafeLabels" />
</html:select></TD>





-----Original Message-----
From: Abhinav (Cognizant) [mailto:[EMAIL PROTECTED]
Sent: Tuesday, May 27, 2003 11:20 AM
To: Struts Users Mailing List
Subject: html:select / html:options


I have a vector of Objects of a class whose attributes are ID and Name.
This vector is set in the form bean.

I want to display that vector as a select/options field.
ID part will form the value and Name the displayable option.

How can this be done.

Thanx a lot.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to