3 // Import required java libraries
5 import javax
.servlet
.*;
6 import javax
.servlet
.http
.*;
7 import javax
.servlet
.annotation
.WebServlet
;
9 @WebServlet(name
="Date", urlPatterns
={"/Date"})
10 // Extend HttpServlet class
11 public class Date
extends HttpServlet
{
13 private java
.util
.Date d
;
14 private Integer count
;
16 public void init() throws ServletException
{
17 // Do required initialization
18 d
= new java
.util
.Date(); // Date at init time, do not change
22 public void doGet(HttpServletRequest request
, HttpServletResponse response
)
23 throws ServletException
, IOException
{
25 // Set response content type
26 response
.setContentType("text/html");
28 // Actual logic goes here.
30 PrintWriter out
= response
.getWriter();
31 out
.println("<html>");
32 out
.println("<body>");
33 out
.println("Date " + d
.toString());
35 out
.println("GET call number " + count
);
36 out
.println("</body>");
37 out
.println("</html>");
40 public void destroy() {