Reputation: 31848
In my Spring MVC application we have form objects that are mapped to by the <form:form
tag in JSP. These objects are separate from my regular model beans, and really form a sort of view model. The difficulty with these objects is the mapping between these objects and the actual model beans expected by the service objects. Currently we have manually written code mapping forms to beans and vice versa in the controllers. This is less than optimal because of the amount of extra code it requires. The other options we've considered are.
BeanUtils.copyProperties
to move them back and forth. This seems bad because it is not an obvious link would cause strange run-time behavior if it wasn't kept consistent.What is the best method for the long term health of the project of performing this action?
Upvotes: 4
Views: 936