如何在thymeleaf迭代中使用JavaScript循环的索引?
我想使用这个JavaScript循环的索引来迭代我的thymeleaf集成。例如:如何在thymeleaf迭代中使用JavaScript循环的索引?,javascript,thymeleaf,Javascript,Thymeleaf,我想使用这个JavaScript循环的索引来迭代我的thymeleaf集成。例如: for(let i=1; i<8; i++){ /*[# th:each="temp : ${arrayListTemperature[ i ] }"]*/ {x: new Date[(${temp})]}, /*[/]*/ } 在将页面发送到浏览器之前,在服务器端执行thymeleaf JavaScript在客户端执行,页面发送到浏览器之后 因此,您所问的看起来是不可能的
for(let i=1; i<8; i++){
/*[# th:each="temp : ${arrayListTemperature[ i ] }"]*/
{x: new Date[(${temp})]},
/*[/]*/
}
在将页面发送到浏览器之前,在服务器端执行thymeleaf JavaScript在客户端执行,页面发送到浏览器之后 因此,您所问的看起来是不可能的:thymeleaf在其执行期间无法访问值,而该值将在thymeleaf执行后存在
/*[# th:each="temp : ${arrayListTemperature1}"]*/
{ x: new Date[(${temp})]},
/*[/]*/