01: /*
02: * TestServlet.java
03: *
04: * Created on 26. kvten 2004, 14:10
05: */
06:
07: package test;
08:
09: import java.io.*;
10: import java.net.*;
11:
12: import javax.servlet.*;
13: import javax.servlet.http.*;
14:
15: /**
16: *
17: * @author lm97939
18: * @version
19: */
20: public class TestServlet extends HttpServlet {
21:
22: /** Initializes the servlet.
23: */
24: public void init(ServletConfig config) throws ServletException {
25: super .init(config);
26:
27: }
28:
29: /** Destroys the servlet.
30: */
31: public void destroy() {
32:
33: }
34:
35: /** Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
36: * @param request servlet request
37: * @param response servlet response
38: */
39: protected void processRequest(HttpServletRequest request,
40: HttpServletResponse response) throws ServletException,
41: IOException {
42: response.setContentType("text/html");
43: PrintWriter out = response.getWriter();
44: /* TODO output your page here
45: out.println("<html>");
46: out.println("<head>");
47: out.println("<title>Servlet</title>");
48: out.println("</head>");
49: out.println("<body>");
50:
51: out.println("</body>");
52: out.println("</html>");
53: */
54: out.close();
55: }
56:
57: /** Handles the HTTP <code>GET</code> method.
58: * @param request servlet request
59: * @param response servlet response
60: */
61: protected void doGet(HttpServletRequest request,
62: HttpServletResponse response) throws ServletException,
63: IOException {
64: processRequest(request, response);
65: }
66:
67: /** Handles the HTTP <code>POST</code> method.
68: * @param request servlet request
69: * @param response servlet response
70: */
71: protected void doPost(HttpServletRequest request,
72: HttpServletResponse response) throws ServletException,
73: IOException {
74: processRequest(request, response);
75: }
76:
77: /** Returns a short description of the servlet.
78: */
79: public String getServletInfo() {
80: return "Short description";
81: }
82:
83: }
|