10 Easy Steps For Creating Custom JSF Components
Sign in

10 Easy Steps for Creating Custom JSF Components

Lead Software Engineer at MSC Software India
Find out the standard HTML component that closely matches your required custom JSF component Write the component class that extends from the identified standard JSF component implementation. Override "getFamily()" method to return a "Family Name" for your custom component Write your custom validator class that performs required UI validations for your custom component. Your validator class implements "Validator" interface in JSF framework Include "addValidator(new YourValidator())" call in your component class. Write your Renderer class by extending "Renderer" class in JSF framework. Override "encode" (generate HTML for the component) and "decode" (interpret HTTP Request and set value to the component) methods based on your requirement. Create "faces-config.xml" Register your custom component class (created in step 2) in faces-config.xml with a unique "Component-Type" name. Register your custom Renderer class (created in step 4) in faces-config.xml with a unique "Renderer-Type" name. Create your custom Tag Handler class that extends "UIComponentTag" class provided by JSF Framework. Override "getComponentType()" and "getRendererType()" accessor methods. Make sure that the Type names returned by these two methods matches the names registered in faces-config.xml (Step 7 and Step 8) Create you Tag Library (TLD) for the custom Tag and associate Tag Handler (created in Step 9) class with the custom component tag.
prevnew
start_blog_img