Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-core/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
for loop-in-play框架1.2.5(groovy模板)_Groovy_Playframework 1.x - Fatal编程技术网

for loop-in-play框架1.2.5(groovy模板)

for loop-in-play框架1.2.5(groovy模板),groovy,playframework-1.x,Groovy,Playframework 1.x,我使用以下代码将for循环与列表一起使用(我也熟悉下面复制的其他语法)。第一个for循环对我不起作用,即使它是同一个列表。关于如何解决此问题的任何想法: #{list items:0..items.size(), as:'item'}${item}#{/list} //Not Working - I have tried moving the items.size out of the loop as well but it has not worked for me 这适用于同一列表: #

我使用以下代码将for循环与列表一起使用(我也熟悉下面复制的其他语法)。第一个for循环对我不起作用,即使它是同一个列表。关于如何解决此问题的任何想法:

#{list items:0..items.size(), as:'item'}${item}#{/list}  //Not Working - I have tried moving the items.size out of the loop as well but it has not worked for me
这适用于同一列表:

#{list items, as:'item'}${item}#{/list}
有什么想法/建议吗?为什么?提前谢谢


编辑:列表是用户定义的实例(主要包含字符串和整数)

语法不正确,items参数需要一个iterable,您给它一个整数,如果您需要索引,您可以使用item_index变量

现在,我使用for循环:for(int I=0;I