File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes  example of source code for insert a date Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark " example of source code for insert a date" Watch " example of source code for insert a date" New topic
Author

example of source code for insert a date

asmaa kellal
Greenhorn

Joined: May 22, 2011
Posts: 18
Hello

I need a simple example of source code to insert a date into a database using jsf what do I have to put in backing bean and page jsf ( i need juste a date )

thanks
Milan Mendpara
Greenhorn

Joined: May 10, 2011
Posts: 7

it might work for you by casting it to GregorianCalendar .........

<ace:dateTimeEntry value="#{backBean.urDate}">
<f:convertDateTime dateStyle="short" pattern="MM/dd/yyyy" type="date" />
</ace:dateTimeEntry>


Calendar cal = Calendar.getInstance();
cal.setTime(urDate);
XMLGregorianCalendar xcal = DatatypeFactory.newInstance().newXMLGregorianCalendar((GregorianCalendar) cal);
obj.setDate(xcal);
// your code
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: example of source code for insert a date
 
Similar Threads
converting dateformat compatible to oracle date
java.sql getTimestamp
Code Conventions
insert date into database using jsf
SQL Column Date Type insertion problem