struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcmoi...@comcast.net
Subject Re: After refreshing Drop Down value has default data
Date Mon, 13 Feb 2006 20:45:32 GMT
Is that  session form ?

 -------------- Original message ----------------------
From: Daniel Kies <danielkies@gmail.com>
> Yes that is the problem I am having.
> 
> On 2/13/06, Tom Ansley <tomansley@gmail.com> 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:danielkies@gmail.com]
> > 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: 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


Mime
View raw message