From the course: Java EE 8: JavaServer Faces JSF 2.3

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Validators and converter enhancements

Validators and converter enhancements

From the course: Java EE 8: JavaServer Faces JSF 2.3

Start my 1-month free trial

Validators and converter enhancements

- [Instructor] Just a refresher, JSF converters are used to convert Java objects in the backing bean to custom text to display on the webpage. They also work in reverse. Given some text, a converter will convert text from the webpage into a Java object in the backing bean. A validator on the other hand, works one way. It prevents unwanted input coming in from the Facelets page or the webpage, into your Java code. Haven't gotten that out of the way, you probably run into this before or heard about it. You have a JPA data source or just a managed bean, and you need to use it inside a JSF converter or validator. You plug in your code, and you inject it with @inject. The code compiles and it's run time, baby! Only at run time you get a no pointer exception or something else. Indicating that the injection never happened. For example, having this, (keyboard typing) and (keyboard typing) trying to inject that,…

Contents