| Author |
retrive data from db2 as month and year wise
|
saswat rashmi
Greenhorn
Joined: Jul 31, 2007
Posts: 14
|
|
hi everyone and good morning i have problem , in my jsp page there is option for month and year .in the month drop down list of month it coming and in year drop down list of year it s coming . now i have to get the data from db2 based on selection of month and year .but in db2 the data is stored as int he form of YYYY/MM/DD i dont how to write the code for this in jsp .please help .please some example how to write the code for this
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26499
|
|
Saswat, If you have a date/calendar object, you can call get(Calendar.MONTH) and get(Calendar.YEAR) to get these fields. If your value is stored in a date/time field in db2, you can use resultSet.getDate() to get a Date object right away. If it really is stored as a char/varchar in the format "YYYY/MM/DD", you will need to call SimpleDateFormat to create a date first.
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26499
|
|
|
I should also mention that it is considered poor practice to have code - especially JDBC code - in a JSP. Better to put it in a Java class or servlet. This makes the code easier to debug and maintain.
|
 |
 |
|
|
subject: retrive data from db2 as month and year wise
|
|
|