users@woodstock.java.net

Facelets & Woodstock

From: Xiaofeng Lin <xlin_at_xsigo.com>
Date: Wed, 01 Aug 2007 11:24:15 -0700

> > Daniel Cavalcanti wrote:
> > > Is so, is there any tutorial on it? If not, how can I set out page
> > > layout/templates using woodstock?

If you meant to use facelets (1.1.*) templates, it's not much different than using any
other JSF components. You just need to make sure that the xml namespaces (xml:ns) of
whatever tags in the page are correct.
Here's one simple example for Facelet template (two files are in the same path although
they don't need to be),

MyTemplate.xhtml

<f:view
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:w="http://www.sun.com/webui/webuijsf"
    contentType="text/html">
<w:page><w:html><w:head/><w:body><w:form>
<div class="top"><ui:insert name="top">Top Part Goes Here</ui:insert></div>
<div class="mainBody"><ui:insert name="mainBody">Main Body Goes Here</ui:insert></div>
</w:form></w:body></w:html></w:page>
</f:view>


MyPage.xhtml

<ui:composition
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:w="http://www.sun.com/webui/webuijsf"
    template="MyTemplate.xhtml">
<ui:define name="mainBody">
...Put Your Customized Main Body Content Here...
</ui:define>
</ui:composition>

Check Facelets Developer's Guide for details.
Good Luck.
--
xflin