Creating Custom JSF Alert Messages component
In web applications,The Jsf frame work didn’t provide the alert functionality for the h:messages tag. So to provide this functionality there are two ways we can provide the messages in the JavaScript Alert.
1. Write a simple methode(By using getResponse from current context),
2. Custom component
I always preferre the second way, because the custom component is the best and we can maintain easly. we can observe the other more befits at the end of this post. So first I will show how to write a custom comonent.
Before writing the custom component I want to ask two simple Questions,
Why we need to go for the Custom component?
When we need to write the Custom component?
Steps for writing Custome component:
* Write a [Name].tld(Tag Library Description)
* Java implementation for the properties
* Faces Configuration
* Renderer class for the custom component
* Java class to represent the Tag.
Download the Netbeans ready made Project for jsf-components
Please follow the Steps to rock the target manually….

1. Create a components pakage
2a) Right click Source Packages
2b) Select ‘New’
2c) Select ‘Other’
2d) Select ‘Java’
2e) Select ‘Java Package’
2f) Click ‘Next’
2g) Enter components as the package name
2h)Click ‘Finish’
3. Create the tag library descriptor
3a) Right click Source Packages
4b) Select ‘New’
4c) Select ‘Other’
4d) Select ‘Web’
4e) Select ‘Tag Library Descriptor’
4f) Click ‘Next’
4g) Enter the following information:
- TLD name:
jsf-components - URI:
http://jsf-components - Prefix:
jc
%GLASSFISH%/lib) to the library dependencies of the project.UIMessagecomponent.UIComponentELTagtag.META-INF/faces-config.xml) for the component: