Monday, January 7, 2013

How to declare custom namespace for composite components

Once you have created few composite components for your company/project, probably you are thinking to declare a custom namespace for these composite components.

This post will show how to declare a custom namespace.
In this post, I will use the previous post - How to package JSF2 composite component as distributable JAR as sample program.

1. create a taglib.xml for existing composite components in the META-INF folder.
adding new taglib.xml

    Content of the taglib.xml
creating custom namespace in taglib.xml
http://kian/jsf/composite/cc  - custom namespace, it could be http://your/company/cc
kian - a folder inside resources, the namespace above will looks for this folder inside resources

2. declare the namespace in XHTML and start using it
using the custom namespace

As an alternative for step 1, we can actually place the taglib.xml in the project workspace instead of bundle with the jar.
1. place the kian.taglib.xml in folder <WebContent>/WEB-INF
2. configure web.xml to read the kian.taglib.xml



Related Posts Plugin for WordPress, Blogger...