Yes that is the problem I am having.

On 2/13/06, Tom Ansley <[EMAIL PROTECTED]> wrote:
>
> Once the form has been submitted can you not set that value on the form
> back
> to the default?
>
> -----Original Message-----
> From: Daniel Kies [mailto:[EMAIL PROTECTED]
> Sent: Monday, February 13, 2006 11:28 AM
> To: Struts Users Mailing List
> Subject: After refreshing Drop Down value has default data
>
> Hello...I have an app where you are on a page that has a drop down with
> select then some values.  After you choose a value the form is submitted.
> Data is reloaded in the array list used to fill the form.  WHen I get back
> to the page the drop down has the value in it that was previously
> selected.
> So if you choose "green" in the drop down, after calling the action and
> loading the drop down's arraylist with "Red", "Blue", and "Green", Green
> is
> selected in the box.  Is there a way i can avoid this so the value goes
> back
> to "Select"?
>
> code from jsp:
> <html:form action="/LoadHomePage">
>     <html:select property="code" onchange="document.all.testForm.submit
> ();">
>
>         <option value="2">Select</option>
>         <html:options collection="colors" property="id"
> labelProperty="name"/>
> </html:select>
>
> Code from action:
> GVO gvo = new GVO();
>         gvo.setId(1);
>         gvo.setName("Red");
>         GVO gvo2 = new GVO();
>         gvo2.setId(2);
>         gvo2.setName("Green");
>         ArrayList a = new ArrayList();
>         a.add(gvo);
>         a.add(gvo2);
>         request.setAttribute("colors", a);
>
> Struts config mapping:
>         <form-bean name="testForm" type="
> org.apache.struts.action.DynaActionForm">
>             <form-property name="code" type="java.lang.String">
>             </form-property>
>         </form-bean>
>
>         <action path="/LoadHomePage" type="test.LoadHomePageAction"
> name="testForm">
>             <forward name="success" path="home.jsp"/>
>         </action>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to