spring-boot表中的复选框引发throwalStateStateException

时间:2019-07-10 21:46:10

标签: java spring-boot thymeleaf

我需要在信息表中获得一个复选框。我有这样的桌子:

<table class="table table-striped" data-toggle="table" data-show-toggle="true" data-classes="table-no-bordered" data-striped="true" data-search="true"  data-show-columns="true" data-pagination="true" style="table-layout: fixed;">
  <thead>
    <th>Carrier Name</th>
    <th>Step 1</th>
    <th>Step 2</th>
    <th>Step 3</th>
    <th>Step 4</th>
    <th>Step 5</th>
    <th>Step 6</th>
    <th>Time to Complete</th>
    <th>Notes</th>
  </thead>
  <tbody>

    <tr th:each="ma,stat : *{marketAccess}">
      <td><p th:text="*{marketAccess[__${stat.index}__].carrierAppointment.parentCompanyCarrier}"></p> </td>
      <td><p th:text="*{marketAccess[__${stat.index}__].carrierAppointment.step1}"></p>
           <input type="checkbox" th:field="*{marketAccess[__${stat.index}__].step1Completed}" th:value="${step1Completed}"/>
          <p style="font-size:12px; display: inline;">Completed?</p><br/>
      
          <!--<td><input type="checkbox"  data-toggle="toggle" data-on="Completed" data-off="Not Completed" data-onstyle="success" th:field="*{marketAccess[__${stat.index}__].step1Completed}"/>-->
          <!--</td>-->
      </td>
      <td>
          <p th:text="*{marketAccess[__${stat.index}__].carrierAppointment.step2}"></p>
          <!--<input type="checkbox" th:field="*{ma.step2Completed}" />-->
      </td>
      <td><p th:text="*{marketAccess[__${stat.index}__].carrierAppointment.step3}"></p>
      </td>
      <td><p th:text="*{marketAccess[__${stat.index}__].carrierAppointment.step4}"></p>
      </td>
      <td><p th:text="*{marketAccess[__${stat.index}__].carrierAppointment.step5}"></p>
      </td>
      <td><p th:text="*{marketAccess[__${stat.index}__].carrierAppointment.step6}"></p>
      </td>
      <td><p th:text="*{marketAccess[__${stat.index}__].carrierAppointment.timeToComplete}"></p></td>
      <td><p th:text="*{marketAccess[__${stat.index}__].carrierAppointment.notes}"></p></td>
    </tr>

  </tbody>
</table>

在添加复选框之前,我能够显示所有表格信息。我一直在尝试不同的方法。我尝试了没有stat.index的情况,我尝试了ma而不是市场准入...但都没有用。

这是我得到的错误: java.lang.IllegalStateException:Bean名称“ marketAccess [0]”的BindingResult和普通目标对象都不能用作请求属性

这是我的控制人:

    @RequestMapping("/client/{id}/credentialTracker")
    public String getCredTracker(@PathVariable("id") Long id, Model model){
        Client client= clientRepository.findById(id);
        List<MarketAccess> marketAccess = marketAccessRepository.findByClient(client);
        model.addAttribute("client", client);
        model.addAttribute("marketAccess", marketAccess);

        return "credentialTracker";
    }

您知道为什么会引发此错误吗?我应该采取什么步骤进行修复?

0 个答案:

没有答案