You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by bobd <gr...@yahoo.com> on 2003/03/05 08:43:00 UTC

help with populating a select box from a bean

The following code successfully iterates over an array
coursetitles stored in bean reference courseCatalog.

<logic:iterate id="element" name="courseCatalog"
property="coursetitles" scope="session">
<bean:write name="element"/>
</logic:iterate> 

I'm now trying to populate a select box and it looks
like <logic:iterate> is not going to work to create
<html:option> elements.  What is the best way to do
this?    

thanks,
-bob







__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/

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


Re: help with populating a select box from a bean

Posted by Jose Gonzalez Gomez <jg...@opentechnet.com>.
    Take a look at <html:options>. I think that's what you're looking for.

    Regards
    Jose

bobd wrote:

>The following code successfully iterates over an array
>coursetitles stored in bean reference courseCatalog.
>
><logic:iterate id="element" name="courseCatalog"
>property="coursetitles" scope="session">
><bean:write name="element"/>
></logic:iterate> 
>
>I'm now trying to populate a select box and it looks
>like <logic:iterate> is not going to work to create
><html:option> elements.  What is the best way to do
>this?    
>
>thanks,
>-bob
>
>
>
>
>
>
>
>__________________________________________________
>Do you Yahoo!?
>Yahoo! Tax Center - forms, calculators, tips, more
>http://taxes.yahoo.com/
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>
>  
>


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


RE: help with populating a select box from a bean

Posted by Robert Taylor <rt...@mulework.com>.
I generally populate a collection of LabelValue beans and put them
in the form or some scope and use optionsCollection tag. For example
if I had a collection of LabelValue beans and named it "categoryOptions"
and my form property was "category", then the following would be the
syntax to render the select box.

<html:select property="category">
<html:optionsCollection property="categoryOptions" label="label"
value="value"/>
</html:select>

HTH,

robert

> -----Original Message-----
> From: bobd [mailto:groovedude76@yahoo.com]
> Sent: Wednesday, March 05, 2003 2:43 AM
> To: struts-user@jakarta.apache.org
> Subject: help with populating a select box from a bean
>
>
> The following code successfully iterates over an array
> coursetitles stored in bean reference courseCatalog.
>
> <logic:iterate id="element" name="courseCatalog"
> property="coursetitles" scope="session">
> <bean:write name="element"/>
> </logic:iterate>
>
> I'm now trying to populate a select box and it looks
> like <logic:iterate> is not going to work to create
> <html:option> elements.  What is the best way to do
> this?
>
> thanks,
> -bob
>
>
>
>
>
>
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Tax Center - forms, calculators, tips, more
> http://taxes.yahoo.com/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


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