Like I said, it can take a real time expression. So you can do 

 <html:select property="selectProperty"
value="<%=(String)request.getAttribute("xyz")%>">
        <html:options property="values" labelProperty="names"/>
 </html:select>

You have to have scriptlets or expressions to set the value dynamically. 


-----Original Message-----
From: Robert Tyler Retzlaff [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 30, 2002 2:25 PM
To: [EMAIL PROTECTED]
Subject: Re: initializing html:select


Yes, but what I'm after is being able to dynamically set the
initial values.  I have an object in the request upon which
the initial value depends.  So specifying it in the value
parameter (unless I used code in the jsp page) isn't any good
and initializing it at declaration doesn't help me either 
because I don't have access to the object in the request.

Any other solutions?

> 
> You can set the value paramater like this
> 
> <html:select property="selectProperty" value="two">
>       <html:options property="values" labelProperty="names"/>
> </html:select>
> 
> Value can take a real time expression. Unfortunately, it currently works
> only if you dont have multiple set to true. It should work in your case.
> 
> -----Original Message-----
> From: Robert Tyler Retzlaff [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, January 30, 2002 2:01 PM
> To: [EMAIL PROTECTED]
> Subject: initializing html:select
> 
> 
> How do you initialize the <html:select> to a particular option
> so that it appears to be the default when the form is loaded.
> 
> 
> .. my ActionForm class
> 
>       private String selectProperty;
>       private String[] values = { ""+1, ""+2 };
>       private String[] names  = { "One", "Two" };
> 
> .. setter/getters
> 
> public void reset( .., ..)
> {
>       selectProperty = values[1];
> }
> 
> .. my form.jsp
> 
> <html:select property="selectProperty">
>       <html:options property="values" labelProperty="names"/>
> </html:select>
> 
> 
> When the form loads I still end up with the selection box
> displaying "One" as opposed to "Two" is there a way to do
> what I would like to accomplish?
> 
> Also, I've hard coded the arrays of values and names into the form
> which I don't like I would like to extract them from an object I
> have stored in the request how might that be achieved?
> 
> 
> Thanks
> 
> rob
> 
> --
> 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]>
> 


--
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