Search code examples
springjspspring-mvcjsp-tags

How to send a form bean to a Spring framework controller not using Spring tags in jsp?


I am looking at the Spring examples and see that they use Spring tags (form and modelAttribute) to send a Post request with a bean. In my understanding it is possible to extract a bean from any HTTP request just using reflection. Does Spring have this possibility using just generic JSP?


Solution

  • Of course it does. In the end, the Spring form tags are just helpers to generate standard HTML form input, textarea and select elements in an easier way. And the form is submitted as any other HTML form.

    So if you have input fields with the appropriate names and submit it to your controller, the command object will be created and populated from the request parameters.