You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Søren Blidorf <so...@nolas.dk> on 2006/11/10 17:22:41 UTC

How can I convert the following to Struts:

<select name="rapport">
<option value="one" selected>one</option>
<option value="two">two</option>
<option value="tree">tree</option>
</select>

This does not work:

<html:select property="rapport">
<html:option value="one" selected>one</option>
<html:option value="two">two</option>
<html:option value="tree">tree</option>
</html:select>

It is very important for me to specify which is "selected"

BR.

Soren, DK


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


Re: SV:

Posted by Laurie Harper <la...@holoweb.net>.
'rapport' needs to be a property on your form bean, not a request 
parameter/attribute. The 'property' attribute on the <html:select> tag 
tells Struts that the current selection is stored in that property. If 
the value of any enclosed <html:option> tag matches the value in that 
property, the corresponding option will automatically be selected.

L.

Søren Blidorf wrote:
> Hi Mike.
> 
> That's what I hoped.
> 
> There is a request.GetParameter("rapport"), but that does not do
> anything to the html:select
> 
> Soren
> 
> -----Oprindelig meddelelse-----
> Fra: Mike Baroukh [mailto:mbaroukh@cardiweb.com] 
> Sendt: 10. november 2006 17:33
> Til: Struts Users Mailing List
> Cc: soren@nolas.dk
> Emne: Re: <option value="" selected> converted to <html:option value="">
> 
> Hi.
> 
> I think that you don't have so specify "selected" : struts will 
> automatically add it if the value of the option is equals to the value 
> of the property ...
> 
> Mike
> 
> 
> Søren Blidorf a écrit :
>> How can I convert the following to Struts:
>>
>> <select name="rapport">
>> <option value="one" selected>one</option>
>> <option value="two">two</option>
>> <option value="tree">tree</option>
>> </select>
>>
>> This does not work:
>>
>> <html:select property="rapport">
>> <html:option value="one" selected>one</option>
>> <html:option value="two">two</option>
>> <html:option value="tree">tree</option>
>> </html:select>
>>
>> It is very important for me to specify which is "selected"
>>
>> BR.
>>
>> Soren, DK
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>   
> 
> 



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


SV:

Posted by Søren Blidorf <so...@nolas.dk>.
Hi Mike.

That's what I hoped.

There is a request.GetParameter("rapport"), but that does not do
anything to the html:select

Soren

-----Oprindelig meddelelse-----
Fra: Mike Baroukh [mailto:mbaroukh@cardiweb.com] 
Sendt: 10. november 2006 17:33
Til: Struts Users Mailing List
Cc: soren@nolas.dk
Emne: Re: <option value="" selected> converted to <html:option value="">

Hi.

I think that you don't have so specify "selected" : struts will 
automatically add it if the value of the option is equals to the value 
of the property ...

Mike


Søren Blidorf a écrit :
> How can I convert the following to Struts:
>
> <select name="rapport">
> <option value="one" selected>one</option>
> <option value="two">two</option>
> <option value="tree">tree</option>
> </select>
>
> This does not work:
>
> <html:select property="rapport">
> <html:option value="one" selected>one</option>
> <html:option value="two">two</option>
> <html:option value="tree">tree</option>
> </html:select>
>
> It is very important for me to specify which is "selected"
>
> BR.
>
> Soren, DK
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>   


-- 

Mike Baroukh

---
Cardiweb  - 31 Rue de Mogador Paris IXeme
06 63 57 27 22 - 01 53 21 82 63 - Jabber: mbaroukh@jabber.org
http://www.cardiweb.com
---




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


Re:

Posted by Mike Baroukh <mb...@cardiweb.com>.
Hi.

I think that you don't have so specify "selected" : struts will 
automatically add it if the value of the option is equals to the value 
of the property ...

Mike


Søren Blidorf a écrit :
> How can I convert the following to Struts:
>
> <select name="rapport">
> <option value="one" selected>one</option>
> <option value="two">two</option>
> <option value="tree">tree</option>
> </select>
>
> This does not work:
>
> <html:select property="rapport">
> <html:option value="one" selected>one</option>
> <html:option value="two">two</option>
> <html:option value="tree">tree</option>
> </html:select>
>
> It is very important for me to specify which is "selected"
>
> BR.
>
> Soren, DK
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>   


-- 

Mike Baroukh

---
Cardiweb  - 31 Rue de Mogador Paris IXeme
06 63 57 27 22 - 01 53 21 82 63 - Jabber: mbaroukh@jabber.org
http://www.cardiweb.com
---