• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

How to create JSF custom tag

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am new to JSF, looking for steps how to create Custom Tomahawk JSF tag.

Thanks
Sri
 
Saloon Keeper
Posts: 28660
211
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The only way to create a custom Tomahawk tag is to join the Apache Tomahawk project and get accepted as a committer.

You can create your own custom JSF tags, however, and they can interact with Tomahawk (or not) as you prefer.

The process of creating a custom JSF tag is not simple, however. It's quite a bit more complicated than creating a custom JSP tag, since in JSF, you break the functionality into rendering and non-rendering parts, and may have multiple renderers. I got my info for doing this from Kito Mann's "JSF In Action" book.
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Srinivasa Murari wrote:I am new to JSF, looking for steps how to create Custom Tomahawk JSF tag.

Thanks
Sri



Preferably, you need a set of classes, and TLD (Tag Library Descriptor Class) and a faces-config XML file for your component.

In my own custom components I usually end up with classes like

MyComponentName - A Component class that extends UICommand, and at the least overrides the methods getFamily, processDecodes and getRendersChildren
MyComponentNameTag - A Component class that is responsible for setting and storing all the attributed that the component has
MyComponentRenderer - A Component class that is responsible for rendering the HTML/JavaScript/XML/etc of your component
MyComponent.tld - A Tag Library Descriptor file that describes the component, each and every attribute, its type and purpose (this is sort of like an XML representation of the *Tag class above)
faces-config.xml - The librarys configfile that tells JSF how to weave the classes above together into a component

Then you have other options as well, such as including a *-taglib.xml file so that Facelets can understand the component, etc.

However, if creating components is all new to you, you should read up on it. JSF in Action is a very decent book. The Sun JSF tutorial (Part of the JEE tutorial) is also quite good (IMO), and is the guide from which I learned to write Custom Components.

Its rather hard for anyone on the forum to be specific for your needs, just because you are asking a very wide quiestion, to which there are many different approaches and possible solutions to. There is also a rather decent learning curve involved.
 
reply
    Bookmark Topic Watch Topic
  • New Topic