Spring 3 MVC - how to turn a form into a query string?
- by caerphilly
I have a simple Spring form that gets bound to a form object on post. The http POST handler does some work, and then needs to redirect to a new URL, passing the form data as querystring parameters.
So, assuming I have a form backing object with properties "param1" and "param2", I want to build a string that looks something like this:
redirect:/app/new/page?param1=value;param2=value
Now, Spring will automatically bind values FROM a querystring or a form post into my form object, but I want to GENERATE a querystring with values taken from the form object.
Obviously it's trivial to do this manually but since I'm going to have lots of different form backing objects, is there some built-in facility in Spring to generate a query string from a form object, suitable for building into a URL?
Thanks.