我在HTML中有一个标签,需要从1到53生成选项,然后选择一个我要使用doPost方法发送的选项。我尝试使用我在这里找到的解决方案: http://forum.thymeleaf.org/generating-content-for-select-programatically-td4024742.html,<select name="week_scroll" style="width: 70px; height: 27px"> <option th:each="n : ${#numbers.sequence(1,53)" th:text="${n}" /> </select> 但是我遇到了一个错误:org.thymeleaf.exceptions.TemplateProcessingException: Could not parse as each: "n : ${#numbers.sequence(1,53)" 此外,生成列表后,我应该使用哪个th:标签来进行选择?
你没有关闭th:each属性中的花括号} 正确的写法应该是 已更新 <select name="week_scroll"> <option>Select</option> <option th:each="n : ${#numbers.sequence(1,53)}" th:value="${n}" th:text="${n}"/> </select>