将单选按钮值绑定到表单后备对象中嵌套对象的属性

时间:2017-10-02 17:26:49

标签: java html spring-boot thymeleaf

我正在使用带有百里香的弹簧靴。

FORM BACKING BEAN:

public class TermReportForm {
    private long gradeid;
    private String gradenumber;
    private Grading grading;}

NESTED OBJECT GRADING FOR FORM BACKING BEAN将由用户输入进行播放:

public class Grading {    
    private String activity;
    private int performance;}

我的表格:

<form class="form-group" th:action="@{/createtermreportforstudent}" th:object="${trf}" method="post"> 
      <div class="form-group" id="TextBoxDiv0">
     <th:block th:id="grading" >
               <input th:id="activity" th:name="activity"  th:field="*{grading.activity}"/>
               <label class="radio-inline">
               <input th:name="performance" th:value="1" type="radio" th:field="*{grading.performance}"/>1</label>
               <label class="radio-inline">
               <input th:name="performance" th:value="2" type="radio" th:field="*{grading.performance}"/> 2 </label>
               <label class="radio-inline">
                  <input th:name="performance" th:value="3" type="radio" th:field="*{grading.performance}"/> 3 </label> 


      </div>
     <button type="submit" class="btn btn-primary">Save</button> 
     </form>

问题在于属性&#34;性能&#34;嵌套对象中的(单选按钮)&#34;分级&#34;没有填充用户选择。另一方面,属性&#34;活动&#34;嵌套对象的(文本输入)填充得很好。我哪里错了?

0 个答案:

没有答案