Learn how to create a workaround for a JSF platform bug with managed beans.
- [Instructor] Now let's fill out the getAsString method.…Now, the getAsString method will get,…obviously, a dessert object in the value parameter,…so given a dessert object, what do we…want to display to the user?…We want to display the dessert names.…So, we want to be sure that value isn't null,…and it's an instance of dessert.…
Given that, we want to return the dessert name.…We'll perform a cast here on line 43,…cast the value, to get the dessert name.…Let's close that out, and otherwise, we'll return nothing.…Recall what I said earlier about converters…acting like lightweight validators.…So in the real world, you code a bit more defensively…in both the getAsObject and the getAsString methods.…
But for the sake of brevity here,…I'm just going to wrap all the code…in a try-catch block, and through a converter exception,…passing in a faces message with the available…exception message, so here for example, we'll try here,…and catch any exception.…And we throw the new converter exception on line 36.…
ConverterException with a new FacesMessage…
- Why use JSF?
- How JSF works
- Using managed beans in JSF
- Building a JSF page using Facelets
- Using Ajax support in JSF
- Processing complex data with JSF converters
- Security in JSF
- JSF and third-party component libraries
Skill Level Beginner
1. Web Application Development in JavaEE
2. Build Your First JSF Page
3. Use Managed Beans in JSF
4. Build a JSF Page Using Facelets
5. Use Ajax Support in JSF
6. Process Complex Data with JSF Converters
7. Protect Your Application with JSF Validation
8. Security in JSF
9. Combine JSF with Other Frameworks
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.