<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<h:dataTable value="#{personBean.addresses}" var="address" cellspacing="1" cellpadding="1" width="100%">
<h:column>
<f:facet name="header">Postcode</f:facet><br/>
<h:outputText value="#{address.postcode}" />
</h:column>
</h:dataTable>
有谁可以告诉我为什么打印每行的标题而不是只打印一次标题?
答案 0 :(得分:1)
请改为尝试:
<h:dataTable value="#{personBean.addresses}" var="address" cellspacing="1" cellpadding="1" width="100%">
<h:column>
<f:facet name="header">
<h:outputText value="Postcode" />
</f:facet>
<h:outputText value="#{address.postcode}" />
</h:column>
</h:dataTable>