The first technique couples your presentation with your business logic more closely 
than does the latter.  So, my preference would be using the <html:options>.

You can maintain the collection that makes up the options in the form bean for the 
page.  Initialization must be handled via the associated action class.

Sri

-----Original Message-----
From: Doug Dates [mailto:[EMAIL PROTECTED]] 
Sent: Sunday, September 29, 2002 8:35 PM
To: Struts Users Mailing List
Subject: html:options


I want to display a dropdown list. The list items are "By First Name", "By Last Name", 
"By Date". I think I can do it by the following way:

<html:select size=1 property="choice">
    <html:option value="fName"> By First Name </html:option>
    <html:option value="fName"> By Last Name </html:option>
    <html:option value="fName"> By Date </html:option> </html:select>

Is there any disadvantages to use above approach compared with using 
<html:options...>? If I use <html:options ... > instead of using above individual 
<html:option...>,as following:

<html:select property="choice" size="1">
      <html:options collection="<%= myArrayList %>" property="value" 
labelProperty="label"/> </html:select>

where should I set myArrayList? in init method of my servlet class, or in my action 
form bean, or somewhere else? I am not quite understand it. Could some one please help 
me?

Thank you

Doug



______________________________________________________________________ 

Post your free ad now! http://personals.yahoo.ca


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


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

Reply via email to