Servlet1.java~1~
资源名称:某公司的java培训教材 [点击查看]
上传用户:dinglihq
上传日期:2013-02-04
资源大小:99958k
文件大小:1k
源码类别:
Java编程
开发平台:
Java
- package filter5;
- import javax.servlet.*;
- import javax.servlet.http.*;
- import java.io.*;
- import java.util.*;
- public class Servlet1 extends HttpServlet {
- private static final String CONTENT_TYPE = "text/html; charset=GBK";
- //Initialize global variables
- public void init() throws ServletException {
- }
- //Process the HTTP Get request
- public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
- response.setContentType(CONTENT_TYPE);
- PrintWriter out = response.getWriter();
- out.println("<html>");
- out.println("<head><title>Servlet1</title></head>");
- out.println("<body bgcolor="#ffffff">");
- out.println("<p>The servlet has received a GET. This is the reply.</p>");
- out.println("</body></html>");
- System.out.println(request.getAttribute("data"));
- }
- //Clean up resources
- public void destroy() {
- }
- }