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
From the course: Java EE 8: JavaServer Faces JSF 2.3
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,…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.