You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.
See Creating Custom EL Functions as a starting point
Create another xml called META-INF/compositions.taglib.xml
<?xml version="1.0"?> <!DOCTYPE facelet-taglib PUBLIC "-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN" "facelet-taglib_1_0.dtd"> <facelet-taglib> <namespace>http://enhancements.seam/jsf</namespace> <tag> <tag-name>print</tag-name> <source>../layout/enhancements/print.xhtml</source> </tag> </facelet-taglib>
Add that to your web.xml
<context-param> <param-name>facelets.LIBRARIES</param-name> <param-value> /META-INF/elfunctions.taglib.xml; compositions.taglib.xml </param-value> </context-param>
Create the print.xhtml in WebContent/layout/enhancements/print.xhtml (JBDS) or view/layout/enhancements/print.xhtml (seam-gen) :
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:s="http://jboss.com/products/seam/taglib" xmlns:rich="http://richfaces.org/rich" xmlns:a="http://richfaces.org/a4j" xmlns:e="http://org.el.func/SeamFunc" xmlns:c="http://java.sun.com/jstl/core"> <h:outputText value="#{e:concat('Hello ', message)}" /> </ui:composition>
Now in your view or WebContent/ folder create test.xhtml
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:s="http://jboss.com/products/seam/taglib" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:rich="http://richfaces.org/rich" xmlns:a="http://richfaces.org/a4j" xmlns:e="http://org.el.func/SeamFunc" xmlns:custom="http://enhancements.seam/jsf" template="/layout/template.xhtml"> <ui:define name="body"> <custom:print message="World" /> </ui:define> </ui:composition>