O'Reilly logo

JSF 2.0 Cookbook by Anghel Leonard

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Renderers/validators for custom components

Based on knowledge from the previous recipe, we will move forward and create a custom component that will be rendered by a custom renderer and will have attached a custom validator (as an exercise, try to add a custom converter as well). Our component will consist of a text field that accepts only valid e-mail addresses; therefore it will extend the UIInput component.

Getting ready

We have developed this recipe with NetBeans 6.8, JSF 2.0, and GlassFish v3. The JSF 2.0 classes were obtained from the NetBeans JSF 2.0 bundled library.

How to do it...

To begin with, let's say that the new component will be named emailInput and it looks as shown next (we have listed the entire JSP page):

<%@page contentType="text/html" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required