We are working on what will turn out to be a very large Spring MVC application. By the looks of it, we’ll have a lot of fields in the JSP that we will have to manually map to the model, and do basic validations (apart from annotated validations).
Are there any frameworks or techniques that will allow us to manage so many fields – some sort of map?
Is anything blocking you from using
@ModelAttribute? It will create the object from the fields from WebRequest.The method of the controller will look like:
I also came to situation where the mapping wasn’t that straight forward and I passed whole
WebRequestto my controller and created few helper methods to get the fields I needed. This was especially helpful for dynamically generated complex structures like treetables etc.And in the helper method I am getting the fields by generating the name and calling: