Hi, I feel that the approach given by Peter would be fine.
You might be populating the drop down by iterating a collection fetched from Database. When you submit the form only the selected value is submitted from the drop down not the entire collection (That is why you do not get the collection back on page load after validation failure). Ideal workaround is to iterate the entire collection again within the JSP and submit the same as hidden. If your collection is of some object having attributes like id and value then you need to submit two separate collections one for each type of attribute. In this case you need to ensure that in your form bean if there is a validation error you need to map the hidden collection back into the form just the way you do it while loading the page from the action class. You will need to iterate through both the collections and remake the collection of objects from the same and set it into the appropriate form property. Please let me know if you need any further information. Regards, Vishal On 1/10/06, Meenakshi Singh <[EMAIL PROTECTED]> wrote: > > Hi, > > I would suggest that manually call validate and use Request Scope > Not many people seem to be using this approach, yet I have found it to be > the best overall solution. > > This is how it works: > First of all make sure you do not have validate="true" set in your action > mapping.You should call form.validate(..) manually. > > Then create a method to set up your request with any lists in scope. For > example if you are using a DispatchAction you can simply have a private > setUp(..) method in this Action. If you are creating separate Action > classes > for all of your different actions you might want to make this a separate > class, or put it in a base Action class that your Actions can extend from. > Now manually call your form's validate method, and then, based on whether > ActionErrors return or not, you can decide what to do. If ActionErrors > returns null/empty then validation was successful and you can continue > your > processing and forward on to success. If ActionErrors is not null/not > empty, > you have validation errors and need to call the setUp method to repopulate > any lists then forward back to the JSP form. > > I am pasting a sample code from an article from a website to implement the > above. > You can look at this sample code & then try to implement it at your end. > > > //class EmployeeDispatchAction > > private void setUp( HttpServletRequest request ) { > Collection jobCodes = Service.getJobCodes(); > request.setAttribute("jobCodes", jobCodes); > } > > public ActionForward setUpForm(ActionMapping mapping, ...) throws > Exception { > setUp( request ); > return (mapping.findForward(UIconstants.TO_FORM)); > } > > public ActionForward update(ActionMapping mapping, ...) throws > Exception > { > ActionErrors errors = form.validate( mapping, request ); > if ( errors != null && !errors.isEmpty ) { > saveErrors(request, errors); > setUp(request); > return (mapping.findForward(UIconstants.VALIDATION_FAILURE)); > } > //Everything OK, continue on... > return (mapping.findForward(UIconstants.SUCCESS)); > } > > > Give it a try!!! > > Thanks & Regards, > Meenakshi. > > PS: Let me know whether it worked for you or not. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >