tags:

views:

167

answers:

2

how to retriving the date only not date and time from database by using servlets and how to display the result in jsp page

A: 

create a servlet that retrieves the date from the database (with a JDBC driver or similar) and sets it as a request parameter (request.setParameter()), then forward the request using the RequestDispatcher to the JSP file.

The jsp file can then access this parameter with request.getParameter().

Mobs
+3  A: 

When you retrieve the date from a date field in the database you are getting both the date and the time as you noticed. This is not a problem. If you want to display only the date then simply configure the display to do so. Assume that you are using JSTL to display:

 <fmt:formatDate type="date" value="${the date}" dateStyle="short"/>

will display only the date and not the time.

Vincent Ramdhanie