You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Hoang, Hai" <Ha...@coair.com> on 2002/09/18 17:31:46 UTC

RE: How do I set the default selection when I'm using html:option s?

You need to populate the value of the property of the dropdown before the
jsp is render...the best way to do this is in the action class.

For example, you have getter and setter for State in the form bean...now you
need to setState("TX") in the action class if you want to have Texas as a
default state.

-----Original Message-----
From: wbchmura@Ensign-BickfordInd.com
[mailto:wbchmura@Ensign-BickfordInd.com] 
Sent: Wednesday, September 18, 2002 10:28 AM
To: struts-user@jakarta.apache.org
Subject: RE: How do I set the default selection when I'm using html:options?


You can add in an <html:option> tag above the <html:options> tag that 
will be the default.



-----Original Message-----
From: mleejr [mailto:mleejr@hotmail.com]
Sent: Wednesday, September 18, 2002 11:21 AM
To: struts-user
Subject: How do I set the default selection when I'm using html:options?


 1) How do I set a default value in an html:select on an options list? I
need the default state to be the one loaded from the struts form.
It doesn't like this.

<html:select property="state" size="1" value="<%= state in ActionForm 
%>">
   <html:options name="allUnitedStates" labelName="allUnitedStates"/>
 </html:select>

thanks everyone,
Mike


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


_________________________________________________________________________
Introducing the all new and improved continental.com.  With a totally new 
personalized design, it's the best place to go. Before you go.

Continental Airlines. Work Hard. Fly Right.

http://www.continental.com


Re: AAAARGH! SOMEONE! How do I set the default selection when I'm using html:options?

Posted by Jan Fetyko <st...@phase2online.com>.
Can you post some code : what are the values of the states, what is the 
definitions in the form, how you're setting the default value , etc.

Jf

Michael Lee wrote:

>Thanks, but nada.
>The ActionForm state is set yet its still not working. :(
>Is the problem with the options?
> <html:select property="state" size="1">
>    <html:options name="allUnitedStates" labelName="allUnitedStates"/>
>  </html:select>
>
>----- Original Message -----
>From: "Hoang, Hai" <Ha...@coair.com>
>To: "'Struts Users Mailing List'" <st...@jakarta.apache.org>
>Sent: Wednesday, September 18, 2002 11:31 AM
>Subject: RE: How do I set the default selection when I'm using html:options?
>
>
>  
>
>>You need to populate the value of the property of the dropdown before the
>>jsp is render...the best way to do this is in the action class.
>>
>>For example, you have getter and setter for State in the form bean...now
>>    
>>
>you
>  
>
>>need to setState("TX") in the action class if you want to have Texas as a
>>default state.
>>
>>-----Original Message-----
>>From: wbchmura@Ensign-BickfordInd.com
>>[mailto:wbchmura@Ensign-BickfordInd.com]
>>Sent: Wednesday, September 18, 2002 10:28 AM
>>To: struts-user@jakarta.apache.org
>>Subject: RE: How do I set the default selection when I'm using
>>    
>>
>html:options?
>  
>
>>You can add in an <html:option> tag above the <html:options> tag that
>>will be the default.
>>
>>
>>
>>-----Original Message-----
>>From: mleejr [mailto:mleejr@hotmail.com]
>>Sent: Wednesday, September 18, 2002 11:21 AM
>>To: struts-user
>>Subject: How do I set the default selection when I'm using html:options?
>>
>>
>> 1) How do I set a default value in an html:select on an options list? I
>>need the default state to be the one loaded from the struts form.
>>It doesn't like this.
>>
>><html:select property="state" size="1" value="<%= state in ActionForm
>>%>">
>>   <html:options name="allUnitedStates" labelName="allUnitedStates"/>
>> </html:select>
>>
>>thanks everyone,
>>Mike
>>
>>
>>--
>>To unsubscribe, e-mail:
>><ma...@jakarta.apache.org>
>>For additional commands, e-mail:
>><ma...@jakarta.apache.org>
>>
>>
>>_________________________________________________________________________
>>Introducing the all new and improved continental.com.  With a totally new
>>personalized design, it's the best place to go. Before you go.
>>
>>Continental Airlines. Work Hard. Fly Right.
>>
>>http://www.continental.com
>>
>>
>>    
>>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
>  
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: AAAARGH! SOMEONE! How do I set the default selection when I'm using html:options?

Posted by Michael Lee <ml...@hotmail.com>.
Thanks, but nada.
The ActionForm state is set yet its still not working. :(
Is the problem with the options?
 <html:select property="state" size="1">
    <html:options name="allUnitedStates" labelName="allUnitedStates"/>
  </html:select>

----- Original Message -----
From: "Hoang, Hai" <Ha...@coair.com>
To: "'Struts Users Mailing List'" <st...@jakarta.apache.org>
Sent: Wednesday, September 18, 2002 11:31 AM
Subject: RE: How do I set the default selection when I'm using html:options?


> You need to populate the value of the property of the dropdown before the
> jsp is render...the best way to do this is in the action class.
>
> For example, you have getter and setter for State in the form bean...now
you
> need to setState("TX") in the action class if you want to have Texas as a
> default state.
>
> -----Original Message-----
> From: wbchmura@Ensign-BickfordInd.com
> [mailto:wbchmura@Ensign-BickfordInd.com]
> Sent: Wednesday, September 18, 2002 10:28 AM
> To: struts-user@jakarta.apache.org
> Subject: RE: How do I set the default selection when I'm using
html:options?
>
>
> You can add in an <html:option> tag above the <html:options> tag that
> will be the default.
>
>
>
> -----Original Message-----
> From: mleejr [mailto:mleejr@hotmail.com]
> Sent: Wednesday, September 18, 2002 11:21 AM
> To: struts-user
> Subject: How do I set the default selection when I'm using html:options?
>
>
>  1) How do I set a default value in an html:select on an options list? I
> need the default state to be the one loaded from the struts form.
> It doesn't like this.
>
> <html:select property="state" size="1" value="<%= state in ActionForm
> %>">
>    <html:options name="allUnitedStates" labelName="allUnitedStates"/>
>  </html:select>
>
> thanks everyone,
> Mike
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>
> _________________________________________________________________________
> Introducing the all new and improved continental.com.  With a totally new
> personalized design, it's the best place to go. Before you go.
>
> Continental Airlines. Work Hard. Fly Right.
>
> http://www.continental.com
>
>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>