Form Handling Support in Spring MVC Model: basically a POJO (Plain Old Java Object) class is created to bind form fields with properties of the object. This object will be put into the model (model object).
In Spring MVC, the @RequestParam annotation is used to read the form data and bind it automatically to the parameter present in the provided method.
Form Backing Object/Command Object This is a POJO that is used to collect all information on a form. It contains data only. It is also called a Command Object in some Spring tutorials. For example, an add a new car form page will have a Car form backing object with attribute data such as Year, Make and Model.
The spring:bind tag provides you with support for evaluation of the status of a certain bean or bean property.
I'm trying to bind one of my model objects to the fields of a form, using Spring-MVC. Everything works fine, except that one of the attributes of the model object is an unordered collection. Doing something like
<c:forEach items="${m.items}" var="i" varStatus="itemsRow">
<form:input path="items[${itemsRow.index}]"/>
</c:forEach>
<form:errors path="items" />
would work fine for a List-type property, but for a Set throws an error when, upon submit, it tries to bind input field content to object attributes.
Is there something in Spring that works out of the box with Sets?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With