permaculture playing cards
The moose likes Beginning Java and the fly likes Date problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Date problem" Watch "Date problem" New topic

Date problem

Meena sabapathy

Joined: May 31, 2009
Posts: 2

I created backin bean in type, for front end i used seperate bean which is of string datatype.but when i set the value to backing bean data type mismatch eror is coming

In backing bean i declared:

private java.sql.Date approvedDate;

In fron end bean i declared:

private String approvedDate;

so if i set crip.setApprovedDate(approvedDate); in fronend bean i getting datatype mismatch error.I dont know how to convert

Can anyone help me to solve this problem.
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
The better would be to use the same form bean, and provide a utility method in the bean say getApprovedDateString(), which suppose to give you the String representation of that date. In that method you can use java.text.DateFormat class to format the date. You can also have a look at Jode Time API. Further, you might want a particular date format through out the application, in that case just define date format some where appropriate.
I agree. Here's the link:
subject: Date problem
It's not a secret anymore!