There are two ways but the best way is to set up a simple bean
like "LabelValueBean" that has two attribute; the option value and the
option description

public class LabelValueBean {
     String label, descrip ; ....
     public String getLabel() { ... }
     public void setLabel( String newValue ) { ... }
     public String getDescription() { ... }
     public void setDescription( String newValue ) { ... }
}

Write a collection and store  LabelValueBean inside it.
Write an action form that allows you get the collection or add
the collection directly to the request scope under a known name.
Then you write your <html:options> tags to get all the options
You need to tell <html:option> the JavaBean property to get the value ie "label" == 
getLabel()
and the display text "description" == getDescription

<html:options collection="myActionForm.countries"
     property="label"
     labelProperty="description"/>

HTH
--
Peter Pilgrim                 ++44 (0)207-545-9923
                                                      //_\\
"Mathematics is essentially the study of islands of  =======
disparate subjects in a sea of ignorance."           || ! ||
Andrew Wiles _____________


---------------------------------------- Message History 
----------------------------------------


From: Francois Duchaussoy <[EMAIL PROTECTED]> on 26/10/2001 12:33

Please respond to [EMAIL PROTECTED]

To:   [EMAIL PROTECTED]
cc:
Subject:  html:options with FormBean


> I have an ActionForm with a Collection object inside.
> I'd like to use the <html:options> tag to display that Collection.
> Could anyone give me an example on how to do that?
>
> something like that??
> <html:options collection="myActionForm.myMap" property="key"
> labelProperty="value"/>
>
> Thanks.
> Francois.





--

This e-mail may contain confidential and/or privileged information. If you are not the 
intended recipient (or have received this e-mail in error) please notify the sender 
immediately and destroy this e-mail. Any unauthorized copying, disclosure or 
distribution of the material in this e-mail is strictly forbidden.


Reply via email to