Rob -

I don't think reset gets called when a form loads.  What I have been doing
is initializing the instance variable.  So in your example :

        private String selectProperty = "your default value";

Pat



-----Original Message-----
From: Robert Tyler Retzlaff [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 30, 2002 3: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]>

Reply via email to