Mapping inputText to Date object in JSF

I am very new to JSF. I am trying to get the date in the inpuText JSF component using a custom datepicker (created using jquery and cannot use the user calendar component). I want to map this inputText to a Java Date object in a bean (which will eventually be saved as Date in DB). One way to achieve this is to save the String in a bean and write converters in getters and setters, which does not look pleasant to me. Is there a recommended approach to solve this problem. Any help / hints / links are appreciated.

+5
source share
2 answers

You can try like this

<h:inputText value="#{backingBean.someDate}">  
   <f:convertDateTime pattern="yyyy-MM-dd"/>  
</h:inputText>

someDate - bean.

+23

, , , , . bean. , , , ( ). , , .

0

All Articles