I'm still not sure about proper using of JSF Templates & Composite Components. I need create an enterprise web applications, which will have a lot of pages. Every page will have the same header, menu, footer and of course different content (= JSF template). The content on every pages will consist of reusable "boxes" (= JSF composite components). The boxes consist of some fileds, buttons etc. Is my solution proper? Or should I use other technology like , Custom Components, decorate ...?
layout.xhtml
<h:body>
<ui:insert name="main_menu">
<ui:include src="/xhtml/template/main_menu.xhtml"/>
</ui:insert>
<ui:insert name="header">
<ui:include src="/xhtml/template/header.xhtml"/>
</ui:insert>
<ui:insert name="content"/>
<ui:insert name="footer">
<ui:include src="/xhtml/template/footer.xhtml"/>
</ui:insert>
</h:body>
customer_overview.xhtml:
<html xmlns:cc="http://java.sun.com/jsf/composite/composite_component">
<h:body>
<!-- Facelet template -->
<ui:composition template="/xhtml/template/layout.xhtml">
<ui:define name="content">
<!-- Composite Components -->
<cc:component_case_history
caseList="#{customerOverviewController.cases}"
/>
<cc:component_customer
....
/>
...
</ui:define>
</ui:composition>
</h:body>
component_case_history.xhtml
<html xmlns:composite="http://java.sun.com/jsf/composite">
<composite:interface>
<composite:attribute name="cases" type="java.util.List"/>
</composite:interface>
<composite:implementation>
<!-- using of "cases" -->
...
</composite:implementation>
CustomerOverviewController.java
@ManagedBean
@ViewScoped
public class CustomerOverviewController {
public List<Case> getCases() {
...
}
}
EDIT 2012-04-27
Based on: When to use <ui:include>, tag files, composite components and/or custom components?
I think that I should use rather Facelet templates + Facelet tag files instead of Facelet templates + Composite components.