“执行处理器时出错”还是某种解析错误?

时间:2019-03-29 18:02:08

标签: javascript spring-boot thymeleaf

当我添加“ 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>

0 个答案:

没有答案