Suppose i have a month, day and year select. One select for each one. And now i need to bind them to a single backing bean property – java.util.Date. How do i get my goal ?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Three ways:
java.util.Calendarwith three getters and three setters.Converter, this is however going to be a bit hacky.rich:calendar.Edit: as per the comments, here’s how option 2 would look like.
page.jsp:mypackage.MyBean:mypackage.DatePartConverter:faces-config.xmlNote that there’s no
Validatorand thatSimpleDateFormatis by defaultlenient. Thus, selecting for example 31 november would produce 1 december. You may need to implement aDatePartValidatoryourself if you want to warn about that.