Validators and Converters in Facelets
Want to wire in a specialized Validator into Facelets with only a few lines of code?
First, lets presume your validator is bound to your JSF Application under the id
Now, with your application's Jar, add a single file with a
Done.
Now you can use it any page and Facelets will take care of wiring all of your properties for you:
Facelets will automatically take care of handling EL also for your UIComponents, Converters, and Validators (any object really), so you could use the built in
What to take from this is that there really isn't any need to write tags when Facelets works off of the bean properties of the object you provide it. But if you do want more control, there are base objects and interfaces that you can implement to pretty much do whatever you want in the document.
First, lets presume your validator is bound to your JSF Application under the id
com.mycompany.RegExpValidator
. It has two properties: a String: pattern, and a boolean: caseSensitive.Now, with your application's Jar, add a single file with a
taglib.xml
extension:
<facelet-taglib>
<namespace>http://www.mycompany.com/jsf
<tag>
<tag-name>regexp</tag-name>
<validator>
<validator-id>com.mycompany.RegExpValidator</validator-id>
</validator>
</tag>
</facelet-taglib>
Done.
Now you can use it any page and Facelets will take care of wiring all of your properties for you:
<input type="text" jsfc="h:inputText" value="#{login.name}">
<my:regexp pattern="\w+" caseSensitive="false"/>
</input>
Facelets will automatically take care of handling EL also for your UIComponents, Converters, and Validators (any object really), so you could use the built in
validateLength
, passing in min="#{field.size}"
.What to take from this is that there really isn't any need to write tags when Facelets works off of the bean properties of the object you provide it. But if you do want more control, there are base objects and interfaces that you can implement to pretty much do whatever you want in the document.
3 Comments:
Looks nifty. Can't wait until 1.2 to try it out.
By a, at 9:11 PM
You can get free free psp games downloads from some sites. But I wouldn't trust them. Too much of a risk to get virus or spyware on your pc. I prefer legit websites that offers unlimited downloads for just a small one time fee. It's very easy to use and its where I get most of my stuff from.
By Anonymous, at 1:36 PM
wholesale jewelry
jewelry wholesale
jewelry store
costume jewelry
wholesale costume jewelry
fashion jewelry
wholesale fashion jewelry
handmade jewelry
wholesale handmade jewelry
wholesale pearl
pearl wholesale
Bridal jewelry
discount jewelry
wholesale crystal jewelry
wholesale semiprecious jewelry
wholesale turquoise jewelry
wholesale shell jewelry
wholesale coral jewelry
wholesale swarovski crystal
china jewelry supplier
wholesale jewelry
costume jewelry
handmade jewelry
fashion jewelry
pearl jewelry
crystal jewelry
Semiprecious jewelry
turquoise jewelry
coral jewelry
shell jewelry
swarovski crystal jewelry
By Anonymous, at 2:06 AM
Post a Comment
<< Home