Reference Manual for Gracelets - 2.0.0.RC2SourceForge.net Logo
2.16 - Tutorial : Writing Component Libraries
Standard JSF and Facelet tag libraries are completely compatible with Gracelets, which is one of the reasons it can harness the investment the open source community has made in this regards. However, many JSF component developers will agree that there is a lot of scaffolding and xml needed along with patience while you redeploy to debug anything that is wrong with the component renderering or processing.

Gracelets provides an alternative for component developers and attempts to make component development easy and simple enough to even be attractive to those who use JSF/Facelets/Gracelets just as a view technology but who do not currently develop reusable code in the form of component libraries.

Some of the advantages of Gracelet Component Libraries are the following:
  • During development they are hot reloadable
  • They can be compiled into java classes for load time improvement for production
  • No need for taglib.xml's, faces-config.xml or any other artifact
  • Very little code to accomplish the same goal
Gracelet component libraries can be stored compiled in a jar that has a gracelets.properties file in it or can be stored in the WEB-INF/gracelet/lib (which allows them to be hot reloadable, no need for redeployment when making changes). In order to be detected as such they must have the case sensitive term 'ComponentLibrary' at the end of their name.

In a single component library you define the namespace, as in the example below:
Toggle Line Numbers
1 namespace = "http://some.namespace.name/taglib" 
This required namespace setting hot-wires it to a Facelet tag library. After that declaration you can define anyone of the following types of components:

Gracelet Library Component Types

JSF Components

Facelets

Gracelet Components

For a reference to parameters and general functionality, please see the Appendix : Component Reference section.

Following are a few tutorial sections dealing with each different class of gracelet library components.