Icefaces custom tag with facelets
I've been struggling with creating my own icefaces tag that I could use everywhere it's needed. There are many tutorials on the internet, BUT.. I couldn't get it work anyway.
When I looked at the sourcecode on the webpage, the tag <ticker:ticker /> was there directly in the HTML sourcecode. This is wrong, because I expected the rendered ouput there.
One whole week I tried to solve this problem trying almost everything. But then, finally, I found it.
So, what was the problem? When you are using Facelets with your JSF/Icefaces, the TLD (tag library descriptor) files are for nothing. Even if I tried to place them everywhere. You have to create the equivalent of the TLD file for the Facelets - the XML file describing the tag structure. In this case it's ticker.taglib.xml
The tag descriptor for the facelets
There you specify the component's class - Ticker, and it's renderer - TickerRenderer. Now, you don't need the TickerTag as suggested when using JSP in many tutorials around the internet.
Also don't forget to tell the JSF to recognize your taglib and place this XML snippet into web.xml (just the first reference to xml, the second is when you want to use also another taglib - eg. the tomahawk components)
Put the reference to your tag descriptor into web.xml
I wonder why this 'trick' hasn't been described yet in some tutorial. So, I hope you will find this remark useful and it will help you when creating your own JSF components.
Get the latest freelance project announcements
ExtraWatch™ FREE is Joomla, Wordpress, Prestashop, Magento plugin with following features: Live Stats, Nightly Email Reports, Goals, Graphs, Anti-spam, History and more