Your FormBean should be flat, meaning it should only have the attribute that your selection box will be submitted. As for the List that you used to populate the Options list, it should be created elsewhere in your application and put it in the session or application scope, then you can use the <html:options/> tag to render you options list. this is better because you can cache this list of options and you don't have to build the list every time the page get render. A more advance technique that can be use is using Tiles and build your list as component that can be declare and use anywhere in your application.
> -----Original Message----- > From: Christopher Book [SMTP:[EMAIL PROTECTED]] > Sent: Tuesday, June 11, 2002 9:49 AM > To: 'Struts Developers List' > Subject: RE: re-populating dropdown boxes > > I've had the same problem before. You're probably setting the options > list > in your form before hand like so: > form.setListOptions(someList); > > But on the next request your form is recreated and you're not repopulating > the value. > What you should be doing is in the getListOptions method of the form, > instead of returning a local list variable, you should be retreiving the > list from elsewhere every time. > > ie > getListOptions() > { > return SomeOtherClass.getList(); > } > > Either that or put your form in the session scope, instead of the request > scope. > > Chris > > -----Original Message----- > From: Raman, Ganapathy [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, June 11, 2002 12:39 PM > To: 'Struts Developers List' > Subject: re-populating dropdown boxes > > > I've just started a project on struts and i'm facing a problem while doing > validations in ActionForm. Say if i have a textbox and a dynamically > generated dropdown box in my page and both the fields are mandatory. I > select a value in the dropdown but do not enter anything in the textfield. > The ActionForm performs the validation and returns an ActionError. But > when > i'm repopulating the screen i do not have all the dropdown values in my > FormBean (only the selected value is sent as part of request). How do i > handle this situation if i should not make any database calls from the > JSP. > I'm sure that this is a standard problem and most of you guys would've > faced > this. It would be great if someone can let me know what is the > right/approppriate way to handle this. > > Thanks in advance, > Gana > > -- > 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]>