HTML and CSS Reference
In-Depth Information
Packaging Components
When you have a reusable component the next natural step is to use it in multiple projects or distribute it to other
developers for general consumption. Keep your classes in the package where they are. The only file you must relocate
is randomtext.taglib.xml . Place the file in the /META-INF directory of the package structure. Make sure that the
TLD file ends with .taglib.xml which is what the JSF implementation is searching for when detecting external tag
libraries.
Listing 6-12. File Structure for Packaging Components
| src/main/java/com/apress/projsf2html5/chapter6/components/RandomTextAPI.java
| src/main/java/com/apress/projsf2html5/chapter6/components/RandomTextComponent.java
| src/main/java/com/apress/projsf2html5/chapter6/components/RandomTextRenderer.java
| src/main/resources/META-INF/randomtext.taglib.xml
Summary
In this chapter we explored the various classes and interfaces that make up the JSF component architecture.
We touched upon two key classes, UIComponent and renderer, and the TLD file. When put together the classes and
file can produce reusable custom components for just about any purpose. As an example we developed a custom
component that talks to a REST website that generates random text based on a couple of parameters.
 
Search WWH ::




Custom Search