01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */package com.test.servlet;
17:
18: import java.io.*;
19:
20: import javax.servlet.ServletConfig;
21: import javax.servlet.ServletException;
22: import javax.servlet.http.HttpServletRequest;
23: import javax.servlet.http.HttpServletResponse;
24:
25: /**
26: * Servlet implementation class for Servlet: SampleServlet
27: *
28: * @web.servlet
29: * name="SampleServlet"
30: * display-name="SampleServlet"
31: *
32: * @web.servlet-mapping
33: * url-pattern="/SampleServlet"
34: *
35: */
36: public class SampleServlet2 extends javax.servlet.http.HttpServlet
37: implements javax.servlet.Servlet {
38: /* (non-Java-doc)
39: * @see javax.servlet.http.HttpServlet#HttpServlet()
40: */
41: public SampleServlet2() {
42: super ();
43:
44: }
45:
46: /* (non-Java-doc)
47: * @see javax.servlet.http.HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
48: */
49: protected void doGet(HttpServletRequest request,
50: HttpServletResponse response) throws ServletException,
51: IOException {
52: // TODO Auto-generated method stub
53: doPost(request, response);
54: }
55:
56: /* (non-Java-doc)
57: * @see javax.servlet.http.HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
58: */
59: protected void doPost(HttpServletRequest request,
60: HttpServletResponse response) throws ServletException,
61: IOException {
62: // TODO Auto-generated method stub
63:
64: PrintWriter out = response.getWriter();
65: out
66: .println("<html><head><title>Sample application with Servlets 2.5</title></head></html>");
67: out.println("<body>");
68: out
69: .println("<font align=Center face=\"Garamond\">Welcome to Servlets 2.5 samples.</font>");
70: out
71: .println("<font align=Center face=\"Garamond\">Another Sample Servlet!</font>");
72: out.println("</body></html>");
73:
74: }
75:
76: public void init(ServletConfig config) {
77: System.out.println("Initializing servlet");
78: }
79:
80: }
|