On 11/24/05, Kanuri, Chand <[EMAIL PROTECTED]> wrote:
> hi all,
> i have a dropdown list in my struts web app,
> i am having a form in which a bean is instatiated(bean has 2 properties
> "name" and "code").
>
> i am using like this in the jsp:
>
> <html:select property="item.code">
>   <logic:iterate id="itemType"
>     name="<%=WebConstants.getItemTypeListName()%>">
>     <option value='<bean:write name="ItemType" property="code"/>'>
>       <bean:write name="ItemType" property="name" />
>     </option>
>  </logic:iterate>
> </html:select>

Have you considered using <html:options> or <html:optionsCollection>
here?  You shouldn't have to do the iteration or write out the
<option> tags yourself.

> now i want to populate property "name" in the item bean(which should not be
> shown on the screen.it should be a hidden field)
>
> when the user clicks on the item name on the dropdown item beans "code" is
> populating.now i need to populate "name" aswell at the sametime using hidden
> property.

Do you really?  You're the one who provided the codes and names for
the drop-down, so you must know what they are... when the form is
submitted, simply use the 'code' to look up the 'name' from the same
place.

I typically keep Maps in Application or Session scope, and use them to
populate select lists across the app (or for a particular user.)

--
Wendy

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

Reply via email to