문제

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>  
</font>
</spring:bind>

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?

올바른 솔루션이 없습니다

다른 팁

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:

http://www.vaannila.com/spring/spring-simple-form-controller-1.html

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top