【发布时间】:2020-08-21 18:07:14
【问题描述】:
<tr th:each="i : ${output.qaCombo}">
<td th:text="${i.questionPhrase}"></td>
<input type="radio" th:field="*{answersChosen}" value="A" /><td th:text="${i.Ans1}"></td>
<input type="radio" th:field="*{answersChosen}" value="B" /><td th:text="${i.Ans2}"></td>
<input type="radio" th:field="*{answersChosen}" value="C" /><td th:text="${i.Ans3}"></td>
<input type="radio" th:field="*{answersChosen}" value="D" /><td th:text="${i.Ans4}"></td>
<br/>
</tr>
我的代码结果:
"answersChosen" 是我的 java 代码中的一个 ArrayList。该网页只允许我选择一个单选按钮,因为未指定数组的索引。我需要每个单选按钮用值填充数组中的一个点。像这样: answerChosen[0] = "A", answerChosen[1] = "B" 我很感激你们可以提供的任何帮助!谢谢!
【问题讨论】: