I believe pretty much every higher-level web API has something to help you along those lines.
For Wicket, I found Repeaters:
Repeaters are components that can render their body markup multiple times. These components are useful for creating output that is traditionally created via loops.
Using a ListView
, for example, you can do this:
Code:
List list = Arrays.asList(new String[] { "a", "b", "c" });
ListView listview = new ListView("listview", list) {
protected void populateItem(ListItem item) {
item.add(new Label("label", item.getModel()));
}
};
Markup:
<span wicket:id="listview">
this label is: <span wicket:id="label">label</span><br/>
</span>
Will result in the following rendered to the browser:
<span wicket:id="listview">
this label is: <span wicket:id="label">a</span><br/>
</span><span wicket:id="listview">
this label is: <span wicket:id="label">b</span><br/>
</span><span wicket:id="listview">
this label is: <span wicket:id="label">c</span><br/>
</span>
There's more advanced examples on that page as well.
For, say, JSF, there's:
<ui:repeat>
, which is similar to
JSTL's forEach
that other posters
have pointed out.
<ui:dataTable>
, which similar to Wicket's ListView
Hope that helps!