From the course: Java EE: JavaServer Faces JSF
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
JSF DateTimeConverter
- [Instructor] Let's try out another incarnation of the converter, the f:convertDateTime component. I'll use this to demonstrate another way you can configure a converter. To make it interesting, we'll use our HTML5 component example. This datetime element is a vanilla HTML5 element that we integrate into JSF. See here, it's a standard HTML element. The value you submit to the page currently is being saved as a string. So, when we do this at 10:15 p.m., let's save the date, that's what we get currently. And we go to back in Bean, we see that it is bound to the dateIn field, which is a string field. Let's use the datetime converter now to save it instead as a Date object. I've gone ahead and added a Date object field to the HTML5 page Bean. Let's change the value binding of the datetime element to our new Date object. Use the dateObjectIn. We'll also change the value binding of the output text to the same field. So we want the dateObjectIn. Now let's configure a datetime converter…
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.