sds*_*brh 1 html java spring drop-down-menu thymeleaf
我有一个<select>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>
Run Code Online (Sandbox Code Playgroud)
但是我收到一个错误:
org.thymeleaf.exceptions.TemplateProcessingException:
Could not parse as each: "n : ${#numbers.sequence(1,53)"
Run Code Online (Sandbox Code Playgroud)
另外,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>
Run Code Online (Sandbox Code Playgroud)