【发布时间】:2023-03-13 08:59:01
【问题描述】:
我有表单,里面有单选按钮选项,我有控制器类和模型。我可以成功保存其他数据,但单选按钮选项始终反映到数据库中为 0。我认为百里香单选按钮的实现有问题。
<form id="add" role="form" th:action="@{/add}" method="post" th:object="${radiobutton}">
<input type="hidden" th:field="*{id}"/>
<div class="form-group">
<label>is it new</label>
<label class="radio-inline">
<input type="radio" name="optionsRadiosInline1" id="optionsRadiosInline1"
value="true" th:checked="*{isNew}"/>Yes
</label>
<label class="radio-inline">
<input type="radio" name="optionsRadiosInline1" id="optionsRadiosInline2"
value="false" th:checked="*{isNew} == false"/>No
</label>
</div>
</form>
【问题讨论】:
标签: thymeleaf