struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Weber <erikwe...@mindspring.com>
Subject Re: [HTML-TAG] select tag and collections : need of a very simple example
Date Mon, 28 Feb 2005 15:13:35 GMT
                                <html:select styleClass="dropdown" 
property="businessState" size="1">
                                  <html:option value="">State:</html:option>
                                  <html:options name="USStateValues" 
labelName="USStateLabels"/>
                                </html:select>

Where USStateValues and USStateLabels are application scope attributes. 
USStateValues is {"AL", "AZ", "AR", . . .} and USStateLabels is 
{"Alabama", "Arizona", . . .} etc. The user sees the label, and the 
value is what's posted.

Erik



St├ęphane Zuckerman wrote:

> Hello,
>
> I am quite new to Struts, but have been playing with this framework 
> for some time now (mostly as a means of understanding the 
> framework)... There is still one thing that isn't clear for me though 
> : I understand how to use a "simple" html:select tag, but when it 
> comes to use a Collection object (such as an ArrayList or a Vector, as 
> these are the objects that are mostly used in tutorials), I am finding 
> myself a little bit confused. I am not sure as to exactly what the 
> attributes of the <html:select/> and <html:options/> refer to. I've 
> already searched through the examples of the distribution, as well as 
> other sites (like jguru), but I really have a problem dealing with 
> select...
>
> My use would be something very basic, such as retrieving a list/array 
> of string values (from a database, for instance), and display them as 
> options for my select. I'd first thought of using something like the 
> <logic:iterate/> tag, but I suppose it wouldn't be very coherent with 
> the existence of <html:options/> ...
>
> Could someone post a very simple case of how to use the html:options 
> tag ?
>
> Thank you very much.
>
> Stephane
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message