I have a page jsp where i will use many attributes from differents POJO Classes so I need to use two commandName in the form. It\'s possible to user multiple @ModelAttribute
It is impossible to have multiple commandName
attributes with a springform:form
tag.
(The implementation org.springframework.web.servlet.tags.form.FormTag
has only a single field to hold this value).
The easiest solution (that defently works) would be using a wrapper command objects, that has to fields.
public class CombinedCommand() {
Activity activity;
Etabl etabl;
//Getter and setter
}
jsp:
<form:form
action="${pageContext.request.contextPath}/ajouter_activite"
method="post" commandName="combinedCommand"">
...
<form:input type="text"path="activity.x"/>
...
<form:input type="text"path="etabl.y"/>
...
</form:form>