What is the usefulness of the following?
;
\"In a template client page using
What is the usefulness of the following?
<ui:composition template="template.xhtml">
With this you can declare to use a basic template which has placeholders to insert template definitions. This is more useful than doing it the other way round. You would need to include for example the header, footer and/or menu in every page again and again. With a template you don't need to do this. It just goes in the template.
"In a template client page using
<ui:composition>
, anything outside of the bounds of a tag is ignored and is not included in the rendered output" (JavaServerFaces 2.0, the complete reference, pg.61)Since everything outside is ignored, why put anything there? Nothing has to be put outside the
<ui:define>
.
You don't need to do so. Why would you? Okay maybe the basic tutorial does that, but that's just for demonstration purposes. "This will not be included in the rendered output" and so on. On the other hand, if you happen to use a visual editor, then the content outside <ui:composition>
will be regarded. See also Is there a way to run a JSF page without building the whole project?
Another thing I don't understand, is that template attribute of composition element is optional. What does it rapresent a template client without the reference to a template?
A simple include file which you can include by <ui:include>
.