Showing posts with label custom taglib. Show all posts
Showing posts with label custom taglib. Show all posts

5/16/2011

4. add primfaces: Example App using Seam 3, RichFaces 4 on eclipse

Building example application seam 3 + richfaces 4 series
4. Add primefaces

1. add jar file
This is quite simple.

You can just add primefaces-3.0.M1.jar (or latest) in WebContent/WEB-INF/lib directory
, and you are ready to use it.

2. add index_primefaces.xml in WebContent directory

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.prime.com.tr/ui">
<f:view>
<h:head>
</h:head>
<h:body styleClass="page">
<h1>Primefaces test</h1>

<div>
<p:tooltip global="true"/>

<h:panelGrid columns="1" cellpadding="5">
<h:form>
<p:commandButton value="Submit" title="Click to save" type="button" />

<h:outputLink value="#" title="Go to">
<h:outputText value="Link" />
</h:outputLink>

<p:inputText title="This is a required field" />
</h:form>
</h:panelGrid>
</div>
</h:body>
</f:view>
</html>



3. deploy it onto Jboss 6

4. http://localhost:8080/seam3-test/index_primefaces.xhtml

3. add taglib: Example App using Seam 3, RichFaces 4 on eclipse

Building example application seam 3 + richfaces 4 series
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