I have a POJO that I'm using successfully in a JSP form. I can display the form, and can post the result back. Here is the modelAttribute bean
public class FooAdminWebDTO implements Serializable {
private static final long serialVersionUID = -5296961362891142744L;
private List<FooDTO> FooDTOList;
private String success = "success"; //..etc
This is an except from my JSP page:
<form:form method="post" class="form-horizontal" id="viewForm"
action="${pageContext.request.contextPath}/FooAdmin/saveFoo" modelAttribute="FooAdminWebDTO">
<div class="form-group">
<form:label class="col-sm-2" path="FooDTO" for="FooDTO" required="true">XYZ:</form:label>
<form:input class="col-sm-5" path="FooDTO" id="FooDTO" type="number" value="${FooAdminWebDTO.FooDTO.FooXYZ}" required="true"/>
</div>
<div class="form-group">
<form:label class="col-sm-2" path="success" for="success" required="true">Success:</form:label>
<form:input class="col-sm-5" path="success" id="success" type="text" value="SUCCESS" required="true"/>
</div>
The problem is in my POST area. I am successfully hitting the correct controller method:
@RequestMapping(value = "/FooAdmin/saveFoo", method = RequestMethod.POST)
public ModelAndView saveFooByID(@ModelAttribute("FooAdminWebDTO") FooAdminWebDTO s, BindingResult bindingResult) {
return new ModelAndView();
}
However, as expected, I'm only seeing the contents of the success field being filled by Spring. The success field is a simple string. (All other complex fields are null).
Here is the object: FooDTO:
@JavascriptMappable
public class FooDTO implements Serializable {
private static final long serialVersionUID = -5974170234812308892L;
private String FooDescription;
private int additionQuantity;
etc..
Please can someone guide me on how to do this? I use XML for configuration, so any answers involving config, please keep this in mind. I have quite deeply nested objects, and need a way to bind my objects to the incoming POST object.
Thank you.