Success message
Cancel

Key Thymeleaf attributes used on this page:


<!-- Form binding: action URL + object binding -->
<form th:action="@{/html/add}" th:object="${student}" method="post">

    <!-- *{field} refers to the th:object's property -->
    <input type="text" th:field="*{id}"/>
    <!-- Equivalent to: id="id" name="id" value="${student.id}" -->

    <!-- select automatically selects matching option -->
    <select th:field="*{course}">
        <option value="Java Web">Java Web Programming</option>
    </select>

</form>

<!-- Controller receives the form data via @ModelAttribute -->
@PostMapping("/add")
public String submit(@ModelAttribute Student student) { ... }