Thymeleaf form submit with ArrayList Object

后端 未结 1 629
南旧
南旧 2021-01-28 08:37

I have written a simple program for form submit with the data(ArrayList) to send from table to controller class.

While submitting the form the data is always empty not s

相关标签:
1条回答
  • 2021-01-28 09:13

    <td /> elements aren't submitted with a form. You need to use some kind of input. It should look something like this:

    <td class="table-data">
      <input type="text" th:field="*{accountList[__${stat.index}__].accountnumber}" />
    </td>
    

    or if you want to submit without seeing the fields as editable, something like this

    <td class="table-data">
      <span th:text="${account.accountnumber}" />
      <input type="hidden" th:field="*{accountList[__${stat.index}__].accountnumber}" />
    </td>
    
    0 讨论(0)
提交回复
热议问题