I am very new to JSF. I am trying to get a Date in JSF inpuText component using a custom datepicker( made using jquery and cannot user calendar component). I want to map this inputText to a Java Date object in the bean (which will eventually stored as Date in DB). One way to achieve this is to keep String in bean and write converters in getters and setters, which doesn't look nice to me. Is there any recommended approach to solve this problem. Any help/hints/links are appreciated.
You can try like this
<h:inputText value="#{backingBean.someDate}">
<f:convertDateTime pattern="yyyy-MM-dd"/>
</h:inputText>
where someDate
is a util date & have accessor methods in the backing bean.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With