【发布时间】:2023-03-24 05:08:01
【问题描述】:
以下工作正常,没有问题
电话查询
<form class="" autocomplete="off" th:object="${user}" method="post" role="form">
<div class="row" style="margin-top: 20px">
<div class="input-field col s8 offset-s2">
<input th:field="*{phoneNo}" id="icon_telephone" type="number" class="validate" style="height: 160px !important; text-align: center; font-size: 100px" data-length="10">
<label for="icon_telephone" style="font-size: 40px">Telephone</label>
</div>
</div>
<div class="row">
<button type="submit" class="btn btn-primary btn-block green darken-1 col s8 offset-s2" name="_eventId_phoneEntered" style="height: 100px; font-size: 33px;">Lookup Phone Number</button>
</div>
</form>
但是,带有 thymeleaf th:each 的表单允许单击按钮,但它只是刷新当前页面
确认客户.html
<div class="row">
<div class="col s12 m9">
<div th:each="addresses: ${addresses}">
<form class="" autocomplete="off" th:object="${address}" method="post" role="form">
<h1 th:text="${addresses.street1}"></h1>
<h1 th:text="${addresses.apt}"></h1>
<h1 th:text="${addresses.special}"></h1>
<button type="submit" class="btn btn-primary btn-block green darken-1 col s8 offset-s2" name="_eventId_useAddress">Lookup Phone Number</button>
<input type="hidden" value="${addresses.idaddresses}" name="idaddresses" />
</form>
</div>
删除所有内容,只留下表单标签和按钮,允许页面继续到流程的下一部分。
<form class="" autocomplete="off" th:object="${address}" method="post" role="form">
<button type="submit" class="btn btn-primary btn-block green darken-1 col s8 offset-s2" name="_eventId_useAddress">Lookup Phone Number</button>
</form>
我尝试将按钮更改为链接并使用 Spring from tags all 无济于事。
我开始认为这与在 th:each 期间分配给按钮的值有关。有什么想法吗?
【问题讨论】:
标签: spring spring-mvc spring-boot thymeleaf spring-webflow