This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

Populating drop-down lists

Feb 3rd, 2005, 02:16 AM

Hi all!

I have a class that extends SimpleFormController. In this formView I have 3 drop-down lists. I have implemented referenceData(request) to populate these drop-down lists.

When the user posts the form I want the user to see the changes appear in the form so I have configured formView = successView, but when the user posts the drop-down lists are not populated. The url contains a parameter (myapp/mypage?parameter=[variable]) so I cannot do a redirect based on the succcessView to make sure referenceData(request) is called again.

What would be the prefferred way of doing this? I could override the onSubmit(request, response, command, errors) and build the redirect url myself, but then I would missout on the configuration of the successView.

This functionallity will be used in multiple forms in my app, and I cannot make changes to the url patterns used.

Comment

The problem is that referenceData is only called when a GET request is issued. In my case I issue a POST and use the same view for formView and successView, and I cannot configure the successView to be a Url and redirect to it after a succesful submit because of changing parameters.

My question is what is the easiest way to add these to the request myself, without having to write the code twice, or would it be easier to create the redirect url myself inside the onSubmit() method.