【发布时间】:2014-10-14 03:37:51
【问题描述】:
我在 HTML 中有一个 <select> 标记,需要生成从 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: 标记从列表中进行选择?
【问题讨论】:
-
您使用的是什么版本的百里香?我相信您需要 2.1.3 才能使这些实用程序类方法起作用。
标签: java html spring drop-down-menu thymeleaf