Spring MVC. Выводится только часть форм HTML

Можете кто-нибудь посоветовать решение, у меня есть Spring MVC приложение, соединенное с БД PostgreSQL. Возникла проблема, что Spring выводит только часть HTML, когда должен выводить полностью. Далее на фото будет понятнее. введите сюда описание изображения

Сейчас, здесь представлена только одна форма, когда их должно быть 5. HTML:

<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>New coffeeMachine</title>
</head>
<body>

<form th:method="POST" th:action="@{/coffeeMashine}" th:object="${coffeeMachine}">
    <label for="name">Enter name of the drink: </label>
    <input type="text" th:field="*{nameOfTheDrink}" id="name"/>
    <div style="color:red" th:if="${#fields.hasErrors('name')}" th:errors="*{nameOfTheDrink}">Name Error</div>
    <br/>
    <label for="sort">Enter sort of coffee: </label>
    <input type="text" th:field="*{sortOfCoffee}" id="sort"/>
    <div style="color:red" th:if="${#fields.hasErrors('sort')}" th:errors="*{sortOfCoffee}">Sort Error</div>
    <br/>
    <label for="milk">Enter kind of milk: </label>
    <input type="text" th:field="*{kindOfMilk}" id="milk"/>
    <div style="color:red" th:if="${#fields.hasErrors('milk')}" th:errors="*{kindOfMilk}">Milk Error</div>
    <br/>
    <label for="amount1">Enter amount of drink: </label>
    <input type="text" th:field="*{amountOfDrink}" id="amount1"/>
    <div style="color:red" th:if="${#fields.hasErrors('amount1')}" th:errors="*{amountOfDrink}">Amount of drink Error</div>
    <br/>
    <label for="amout2">Enter amount of coffee: </label>
    <input type="text" th:field="*{amountOfCoffee}" id="amout2"/>
    <div style="color:red" th:if="${#fields.hasErrors('amount1')}" th:errors="*{amountOfCoffee}">Amount of coffee Error</div>
    <br/>
    <input type="submit" value="Create!"/>
</form>

</body>
</html>


</body>
</html>

Контроллер:

@GetMapping("/new")
    public String newPerson(@ModelAttribute("coffeeMachine") CoffeeMachine coffeeMachine) {
        return "coffeeMachine/new";
    }

    @PostMapping()
    public String create(@ModelAttribute("coffeeMachine") @Valid CoffeeMachine coffeeMachine,
                         BindingResult bindingResult) {
        if (bindingResult.hasErrors())
            return "coffeeMachine/new";

        coffeeMachineDAO.save(coffeeMachine);
        return "redirect:/coffeeMachine";
    }

И DAO:

public void save(CoffeeMachine coffeeMachine){
        try{
            PreparedStatement statement =
                    connection.prepareStatement("INSERT INTO coffeeMachine3 VALUES(1, ?, ?, ?, ?, ?)");

            statement.setString(1, coffeeMachine.getNameOfTheDrink());
            statement.setString(2, coffeeMachine.getSortOfCoffee());
            statement.setString(3, coffeeMachine.getKindOfMilk());
            statement.setDouble(4, coffeeMachine.getAmountOfDrink());
            statement.setInt(5, coffeeMachine.getAmountOfCoffee());

            statement.executeUpdate();
        } catch (SQLException exception) {
            exception.printStackTrace();
        }
    }

Может кто-нибудь знает, как это можно решить?


Ответы (0 шт):