path in spring form

Solutions on MaxInterview for path in spring form by the best coders in the world

showing results for - "path in spring form"
Jana
02 Oct 2019
1// The path attribute is bound into java properties using java beans convention.
2// For example for following form:
3<form:form method="post" modelAttribute="theStudent">
4  Name: <form:input type="text" path="name"/>
5  Cool?: <form:input type"checkbox" path="cool"/>
6  <button>Save</button>
7</form:form>
8// And following controller handler method:
9@RequestMapping(...)
10public String updateStudent(@ModelAttribute("theStudent") Student student) {
11  // ...
12}
13// Will bind automatically if the Student class is defined with following properties:
14public class Student {
15  private String name;
16  public String getName() { return this.name; }
17  public void setName(String name) { this.name = name; }
18
19  private boolean cool;
20  public boolean isCool() { return this.cool; }
21  public void setCool(boolean cool) { this.cool = cool; }
22}