My application is using Spring MVC. On the way from the Controller to the view we are taking adventage of this framwork by creating a bean of the model that is used to display the relevant properties through the JSP. On the way back however, meaning after submitting a form back to the controller, it is using a raw HTTPRequest instead of a structured formBean.

I think that this is a disadvantege so I am looking for way to insert this to our MVC model. I saw in this link some way that Spring MVC handles it. by adding to the JSP binding such as:

<spring:bind path="command">  <font color="red">    <b><c:out value="${status.errorMessage}"/></b>  

and to the controller:

 protected ModelAndView onSubmit(Object command) throws ServletException  
{    Widget widget = (Widget) command;

But this solution is not good for our implementation - I don't want to add anything to the JSP and in addition . some of the parameters that are added to the httprequest are done in javascript code. Therefore I am looking for a solution that can create formBean out of the form parameters while the mapping is not defined on the JSP but elsewhere (in some dedicated xml obviously).

Any ideas?

No correct solution


The simplest way to use a form (command) bean in Spring is to write a controller that extends SimpleFormController.

A quick Google shows a number of basic tutorials - for example:

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow