Dee*_*ass 13 html html5 spring jsp thymeleaf
我是thymeleaf的新手,正在将我的所有jsp代码转换为thymeleaf.我不知道如何将以下代码转换为thymeleaf.有谁知道如何将以下代码转换为thymeleaf
?
<logic:iterate id="id" property="idList" name="sampleForm" indexId="i">
<label for="id<%=i%>">
<bean:write name="id" property="id" />
</label>
</logic:iterate>
Run Code Online (Sandbox Code Playgroud)
请告诉我如何初始化索引值thymeleaf
以用于某些值?
Tom*_*lst 18
<label th:each="id,status : ${idList}" th:for="|id${status.index}|" th:text="${id.id}"></label>
Run Code Online (Sandbox Code Playgroud)
th:each
将迭代idList
,分配每个项目id
并label
为每个项目创建一个.可以通过添加额外的名称来指定项目的状态,以逗号分隔(status
在此示例中).th:for
将设置for
标签的属性.管道(|
)用于简单的字符串连接.th:text
将标签的内部文本设置为ID. 归档时间: |
|
查看次数: |
32680 次 |
最近记录: |