Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between modelAttribute and commandName [duplicate]

Tags:

What is the difference between using commandName and modelAttribute when sending form data?

<form:form method="post" modelAttribute="csvFileUploadVO"> 

and

<form:form method="post" commandName="csvFileUploadVO"> 

At which point of time should I use either of them?

like image 619
puissant Avatar asked Sep 13 '12 10:09

puissant


People also ask

What is the difference between model and @ModelAttribute?

As Model needs a pair of name and value to populate, @ModelAttribute element 'value' is used as attribute name and the method returned object is used as value. If no 'value' is specified in @ModelAttribute then the returned type is used as the attribute name.

What is commandName form tag?

The commandName attribute is the most important attribute in the form tag, which specifies the model attribute name that contains a backing object and the properties of this object will be used to populate the generated form.


1 Answers

There is no difference, two different attributes exist for historical reasons.

like image 197
axtavt Avatar answered Oct 19 '22 18:10

axtavt