⭕️Spring⭕️ A little summary of what I learned today!
Form tags that are common in JSP (view)! What is the model Attribute on the first line? .. ..
1<form:form modelAttribute="□□□">
2
3<p><form:input path="id" /></p>
4<p><form:input path="name" /></p>
5
6<input type="submit" value="Registration" />
7
8</form:form>
In the □□□ part, specify the Model name (the one with many setters and getters) that has the id and name sent in the 3rd and 4th lines! (It seems that the first letter should be lowercase)
Q: Isn't it different from the Model name if the first letter is lowercase?
A: For example, if the above Model name is MemberModel With the controller's doGET method
model.addAttribute("memberModel",new MemberModel());
Described as. (I can't explain it well, but it seems necessary because it has the id and name I want to use ...)
Because it uses the memberModel of the first argument of this
The value of modelAttribute of the form tag seems to have the same name as Model but the first letter is lowercase!
If you write something wrong, I would appreciate it if you could tell me.
Recommended Posts