Reputation: 20232
I am trying to render a list within a list while using the groovy template for play framework 1.2+. However, when I use the #{list} tag within a #{list} tag, I do not get the desired result. Can anyone share how they have approached this in while using the groovy template for play (whether using Groovy or CSS). Thanks in advance
Upvotes: 0
Views: 720
Reputation: 10346
I created a little sample project with Play 1.2.5 and modified these two files:
Application.java:
public class Application extends Controller {
public static void index() {
List<List<String>> listWithLists = new ArrayList<List<String>>();
List<String> listInList1 = new ArrayList<String>();
listInList1.add("1st element in 1st list");
listInList1.add("2nd element in 1st list");
listWithLists.add(listInList1);
List<String> listInList2 = new ArrayList<String>();
listInList2.add("1st element in 2nd list");
listInList2.add("2nd element in 2nd list");
listWithLists.add(listInList2);
render(listWithLists);
}
}
index.html:
<ul>
#{list items:listWithLists, as:'listWithinList'}
#{list items:listWithinList, as:'string'}
<li>${string}</li>
#{/list}
#{/list}
</ul>
Upvotes: 2