Monday, 2 January 2012

Icefaces Facelet Custom Component

How to create Icefaces Facelet Custom Component.

Do the following configuration
Add following Jar files
    el-ri.jar
    icefaces-facelets.jar
    servlet-api.jar
   
in web.xml

<context-param>
    <param-name>facelets.DEVELOPMENT</param-name>
    <param-value>true</param-value>
</context-param>

<context-param>
    <param-name>facelets.LIBRARIES</param-name>
    <param-value>/WEB-INF/facelets/tags/externalcomp.taglib.xml</param-value>
</context-param>


in faces-config.xml

<application>
    <view-handler>com.icesoft.faces.facelets.D2DFaceletViewHandler</view-handler>
</application>


now create "externalcomp.taglib.xml" in /WEB-INF/facelets/tags/ and add following

<facelet-taglib>
    <namespace>http://www.abctaglib.com/jsf</namespace>
    <tag>
        <tag-name>MyComponent</tag-name>
        <source>mycomponent.jspx</source>
    </tag>
</facelet-taglib>

   
Now you can use your custom tag in your jspx file including folloeing content..


<ui:composition xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ice="http://www.icesoft.com/icefaces/component"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:mycomp="http://www.abctaglib.com/jsf">
               
        <mycomp:MyComponent .... here you can pass your parameter ....  ></mycomp:MyComponent>
        /// like
        <mycomp:MyComponent myvalue="10"></mycomp:MyComponent>
        //.....
        //.....
       
</ui:composition>



<mycomp:MyComponent myvalue="10"></mycomp:MyComponent>

You can use myvalue parameter in "mycomponent.jspx".
for example in "mycomponent.jspx" you want to print "myvalue",

<ice:outputText id="fromMyValue" value="#{myvalue}" />




...................................................................................................................

No comments:

Post a Comment

Infinidb _CpNoTf_ problem

infinidb table with a varchar column insert string as a '_CpNoTf_' while using Cpimport. The Problem is occured if inserted string ...