Is there a way to obtain the post data itself? I know spring handles binding post data to java objects. But, given two fields that I want to process, how can I obtain that data?
For example, suppose my form had two fields:
<input type="text" name="value1" id="value1"/>
<input type="text" name="value2" id="value2"/>
How would I go about retrieving those values in my controller?
If you are using one of the built-in controller instances, then one of the parameters to your controller method will be the Request object. You can call
request.getParameter("value1")to get the POST (or PUT) data value.If you are using Spring MVC annotations, you can add an annotated parameter to your method’s parameters: