You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Michael Skariah <ms...@anshinsoft.com> on 2001/07/03 22:17:50 UTC

Logic:Iterate in html:option

Hello all,
I am trying to fill up an option value in a JSP file using the bean:write
tag.
Below is the code. I have the values present for the property and do not get
any errors, but string written to the option is empty ("").
Could anyone tell me if something else has to be done.
Thanks in advance,
Michael.

------------------------------------------------
<html:select property="selectedValue" value="">
<html:option value=""></html:option>
<logic:iterate id="item" name="list">
<html:option value="<bean:write name='item' property='accountNo'/> ">
</html:option>
</logic:iterate>
</html:select>
------------------------------------------------


Re: Logic:Iterate in html:option

Posted by Rama Krishna <kr...@hotmail.com>.
hi michael,

the follwing works for me.

<bean:define id="myCollection" name="formBean" property="records" />
      <html:select name="formBean" property="xxx">
            <html:options collection="myCollection" property="value" />
      </html:select>

i have a getValue() method in my formbean. where xxx is a setXXX method
which will have the selected item and records is a collection

hope this helps
rama.


----- Original Message -----
From: "Michael Skariah" <ms...@anshinsoft.com>
To: <st...@jakarta.apache.org>
Sent: Tuesday, July 03, 2001 1:17 PM
Subject: Logic:Iterate in html:option


> Hello all,
> I am trying to fill up an option value in a JSP file using the bean:write
> tag.
> Below is the code. I have the values present for the property and do not
get
> any errors, but string written to the option is empty ("").
> Could anyone tell me if something else has to be done.
> Thanks in advance,
> Michael.
>
> ------------------------------------------------
> <html:select property="selectedValue" value="">
> <html:option value=""></html:option>
> <logic:iterate id="item" name="list">
> <html:option value="<bean:write name='item' property='accountNo'/> ">
> </html:option>
> </logic:iterate>
> </html:select>
> ------------------------------------------------
>
>