Component which can take a collection and render it without any markup
Is there a JSF component which can take a collection of items and render it the way I want? Like a h:data开发者_高级运维Table
, but then without the markup of a HTML <table>
.
If you're using Facelets, use <ui:repeat>
.
<html xmlns:ui="http://java.sun.com/jsf/facelets">
...
<ui:repeat value="#{bean.list}" var="item">
#{item}<br />
<ui:repeat>
Or when you're still on legacy JSP, use JSTL <c:forEach>
.
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
...
<c:forEach items="#{bean.list}" var="item">
#{item}<br />
</c:forEach>
精彩评论