You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Sloan Seaman <sl...@sgi.net> on 2003/05/06 16:25:45 UTC

Populating

I want to have a form that has a select box where a user can choose from 1-100.

I don't want to have to have 100 <html:option> tags and I figure that the <logic:iterate> would do it for me, but I'm not sure how to do it and still have Struts select the proper value when the user goes to edit the page and I want to pre-populate it.

Any idea's?

Thanks!

--
Sloan


________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs Email
Security System. For more information on a proactive email security
service working around the clock, around the globe, visit
http://www.messagelabs.com
________________________________________________________________________

RE: Populating

Posted by Joseph Yang <ya...@rewardstream.com>.
Use <html:options/> tag as following:

1. Set up the collection (e.g., Vector) somewhere and put into
servletContext (or request, session as you like), this collection will be
the collection of label-value beans (a bean with label and value as it's
properties)

2. On jsp

<jsp:useBean id="provinceList" scope="application"
class="java.util.Vector"/>

<html:select property="province">
     <html:options collection="provinceList" property="value"
labelProperty="label"/>
</html:select>

-----Original Message-----
From: Sloan Seaman [mailto:sloan@sgi.net]
Sent: Tuesday, May 06, 2003 7:26 AM
To: Struts Users Mailing List
Subject: Populating <html:option>


I want to have a form that has a select box where a user can choose from
1-100.

I don't want to have to have 100 <html:option> tags and I figure that the
<logic:iterate> would do it for me, but I'm not sure how to do it and still
have Struts select the proper value when the user goes to edit the page and
I want to pre-populate it.

Any idea's?

Thanks!

--
Sloan


________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs Email
Security System. For more information on a proactive email security
service working around the clock, around the globe, visit
http://www.messagelabs.com
________________________________________________________________________


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