«Ошибка при выполнении процессора» или какая-то ошибка разбора? - PullRequest
0 голосов
/ 29 марта 2019

Когда я добавляю "th: field =" {} "", все ломается.Я не понимаю почему.Когда я сделал это «добавить» вещь в другом классе, все работает нормально.Но теперь я хочу показать список и добавить строки на той же странице, но это не работает вообще.

    <form th:object="${product}" th:action="@{save}" action="#" method="post">
        <label for="name">Product</label>
        <input type="text" />
        <label for="qty">QTY</label>
        <input type="text" />
        <label for="department">Department</label>
        <select  th:field="*{Department}">
            <option th:each="department : ${departments}" th:value="${department.departmentId}" th:text="${department.name}"></option>
        </select>

            <input type="submit" value="add" />
    </form>
<!-- <form th:object="${product}" th:action="@{save}" action="#" method="post">
        <label for="name">Product</label>
        <input type="text" id="name" th:field="*{name}" />
        <div style="clear: both; display: block; height: 10px;"></div>

        <label for="qty">QTY</label>
        <input type="text" id="qty" th:field="*{qty}" />
        <div style="clear: both; display: block; height: 10px;"></div>

        <label for="department">Department</label>
        <select id="category" th:field="*{department}" class="form-control" >
            <option th:each="department : ${departments}" th:value="${department.departmentId}" th:text="${department.name}"></option>
        </select>
        <div style="clear: both; display: block; height: 10px;"></div>

        <input type="submit" value="save" />
    </form> -->

<form th:action="@{/logout}" method="post">
    <input type="submit" value="Log out" class="btn btn-sm btn-danger" />
</form>
<form th:action="@{/shoppinglist}" method="get">
<table class="table table-stripped">
    <tr>
        <th>Product</th>
        <th>QTY</th>
        <th>Department</th>
        <th> </th>
    </tr>
    <tr th:each = "product : ${products}">
        <td th:text="${product.name}"></td>
        <td th:text="${product.qty}"></td>
        <td th:text="${product.department.name}"></td>
        <td><a th:href="@{/delete/{id}(id=${product.id})}" class="btn btn-danger">Poista tuote</a></td>
    </tr>
</table>
</form>

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...