3. Add custom taglib
If you are already using custome taglib on jsf1.2 with facelet, there is nothing changed. You can reuse existing taglib as it is.
1. To setup seam 3 + richfaces 4 check
Building example application seam 3 + richfaces 4 series
3. Add custom taglib
2. add following configuration on web.xml
<context-param>
<param-name>facelets.LIBRARIES</param-name>
<param-value>/taglib_test/taglib_test.taglib.xml</param-value>
</context-param>
3. create custom tag
3.1 create taglib_test directory on WebContent
3.2 create taglib_test.taglib.xml file in WebContent/taglib_test directory
<?xml version="1.0"?>
<!DOCTYPE facelet-taglib PUBLIC
"-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN"
"http://java.sun.com/dtd/facelet-taglib_1_0.dtd">
<facelet-taglib>
<namespace>http://test.com/tl_test</namespace>
<tag>
<tag-name>test_panel</tag-name>
<source>taglib_test.xhtml</source>
</tag>
</facelet-taglib>
3.3 create taglib_test.xhtml file in WebContent/taglib_test directory
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:rich="http://richfaces.org/rich">
<rich:panel header="Tag lib testing">
This is testing for custom taglib. This is remained same as before in JSF 1.2.
</rich:panel>
</ui:composition>
4. create index_with_taglib.xhtml in WebContent directory
<!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:ui="http://java.sun.com/jsf/facelets"
xmlns:rich="http://richfaces.org/rich"
xmlns:tt="http://test.com/tl_test"
template="template.xhtml">
<ui:define name="content">
<h1>Seam 3 taglib test</h1>
<tt:test_panel />
</ui:define>
</ui:composition>
5. deploy it onto Jboss 6
6. http://localhost:8080/seam3-test/index_with_taglib.xhtml
No comments:
Post a Comment