On 2/13/06, Daniel Kies <[EMAIL PROTECTED]> wrote: > 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>
Maybe this can help you: http://wiki.apache.org/struts/StrutsWidgets It uses optionsCollection instead of options, but it is still relevant. In any case, I think that solution presented there (to set "value" in <html:select>) is not a proper one, because what is displayed and what was submitted gets out of sync. I would rather use value from "code" property, and then set "code" back to "2". On 2/13/06, Daniel Kies <[EMAIL PROTECTED]> wrote: > I changed the action mapping to: > <action path="/LoadHomePage" type="test.LoadHomePageAction" > name="testForm" scope="request"> > <forward name="success" path="home.jsp"/> > </action> > > So it should be request data, but it keeps the previously selected item in > the list after submitting the form and returning to the page. Because you do not do redirect the whole request/response sequence is "served" by one request. This is normal. Michael. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]