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.
-
1Why aren't you considering to use a library like PrimeFaces that already provides working solutions for these kind of problems? See p:calendar for exampleperissf– perissf2012-05-22 10:19:47 +00:00Commented May 22, 2012 at 10:19
-
@perissf: Yes I am using richfaces and as I have mentioned in my question that I cannot use "calendar component". Actually we have designed and customized our own datepicker. Can't we achieve it with jquery datepicker ?Umer Hayat– Umer Hayat2012-05-22 10:23:45 +00:00Commented May 22, 2012 at 10:23
-
3@Umer Hayat - the core API comes with a convertDateTime converter.McDowell– McDowell2012-05-22 10:46:28 +00:00Commented May 22, 2012 at 10:46
-
@McDowell : Thanks a lot for pointing it out. It solved my problemUmer Hayat– Umer Hayat2012-05-22 11:30:42 +00:00Commented May 22, 2012 at 11:30
Add a comment
|
2 Answers
I am not sure if I understood your question well, although from what I understood so far your problem doesn't look complex at all. Just save your input in the proper manner and pass the value to your bean. Properties of date class such hour, minute seconds have been deprecated (although you can still use them). Also you can try to just pass the long value, but I´m not sure how that works. You should find all the needed specification here