【问题标题】:Thymeleaf shows null on form when using th:field?Thymeleaf 在使用 th:field 时在表单上显示 null?
【发布时间】:2021-09-23 14:21:08
【问题描述】:

在 Thymeleaf (spring-boot-starter-thymeleaf) 当前版本中使用 Spring。当我有一个某些字段为空的表单时,Thymeleaf 在输入控件中显示为空。如何让它只显示空白?

只有在我使用 fetch 和 replace div 时才会发生这种情况。如果我从 URL 打开一个窗口,则内容很好。发生了什么事?

TIA

<label for="address1">Address:</label>
<input type="text" name="address1" id="address1" th:field="*{address1}"> <br>

<label for="address2">&nbsp;</label>
<input type="text" name="address2" id="address2" th:field="*{address2}"> <br>

【问题讨论】:

    标签: thymeleaf


    【解决方案1】:

    没关系。我意识到我有一些绑定代码没有进行检查。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-03-07
      • 1970-01-01
      • 2013-12-20
      • 1970-01-01
      • 2019-03-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多