How to repeat output of some content in JSF using only standard tags (ui:, h: etc) ? In other words – how to do equivalent to PHP code below in JSF ? I immediately wanted to take advantage of ui:repeat, but it needs collection – I have only number.
for ($i = 0; $i < 10; $i++) {
echo "<div>content</div>";
}
JSF 2.3+
If you’re already on JSF 2.3+ then you can use
begin/endattributes of<ui:repeat>.JSF 2.2-
If you’re not on JSF 2.3 yet, then either use
<c:forEach>instead (true, mixing JSTL with JSF is sometimes frowned upon, but this should not harm in your particular case because you seem to want to create the view "statically"; it does not depend on any dynamic variables):Or create an EL function to create a dummy array for
<ui:repeat>:which is registered in
/WEB-INF/util.taglib.xml:and is been used as follows