jsf facelets可以做下一步吗?
我想用其他html列扩展reusable.xhtml
reusable.xhtml
<ui:composition>
<table class="table table-striped table-hover table-condensed">
<thead>
<tr>
<ui:insert name="additional_headers"></ui:insert>
</tr>
</thead>
<tbody>
<c:forEach items="${beanChooser.chosenBean.entitiesToShow}" var="item">
<tr id="#{beanChooser.chosenBean.shortEntityName.toLowerCase()}${item.id}">
<td>
</td>
<td>
</td>
<ui:insert name="additional_columns"></ui:insert>
</tr>
</c:forEach>
</tbody>
</table>
</ui:composition>
<html>
<ui:composition template="/masterTemplate.xhtml" ...>
<ui:define name="content">
<ui:include src="../reusable.xhtml">
<ui:define name="additional_columns">
<td>
Additional EL Expression
</td>
</ui:define>
<ui:define name="additional_headers">
<th>
STATIC
</th>
</ui:define>
</ui:include>
</ui:define>
</ui:composition>
</html>
如果不是不可能的话,实现这一目标的最佳做法是什么?
答案 0 :(得分:2)
我认为您需要的是<ui:decorate>
而不是<ui:include>
(请查看<!-- HERE -->
标记):
<ui:composition template="/masterTemplate.xhtml" ...>
<ui:define name="content">
<ui:decorate template="../reusable.xhtml"><!-- HERE -->
<ui:define name="additional_columns">
<td>
Additional EL Expression
</td>
</ui:define>
<ui:define name="additional_headers">
<th>
STATIC
</th>
</ui:define>
</ui:decorate> <!-- HERE -->
</ui:define>
</ui:composition>