FeedServlet.java
上传用户:cdpainuo
上传日期:2022-07-12
资源大小:5257k
文件大小:1k
源码类别:

Jsp/Servlet

开发平台:

Java

  1. package com.appspot.cindyblog.servlet;
  2. import java.io.IOException;
  3. import java.io.PrintWriter;
  4. import javax.servlet.ServletException;
  5. import javax.servlet.http.HttpServlet;
  6. import javax.servlet.http.HttpServletRequest;
  7. import javax.servlet.http.HttpServletResponse;
  8. public class FeedServlet extends HttpServlet {
  9. public void doGet(HttpServletRequest request, HttpServletResponse response)
  10. throws ServletException, IOException {
  11. response.setContentType("text/html");
  12. PrintWriter out = response.getWriter();
  13. out.println("<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">");
  14. out.println("<HTML>");
  15. out.println("  <HEAD><TITLE>A Servlet</TITLE></HEAD>");
  16. out.println("  <BODY>");
  17. out.print("    This is ");
  18. out.print(this.getClass());
  19. out.println(", using the GET method");
  20. out.println("  </BODY>");
  21. out.println("</HTML>");
  22. out.flush();
  23. out.close();
  24. }
  25. public void doPost(HttpServletRequest request, HttpServletResponse response)
  26. throws ServletException, IOException {
  27. this.doGet(request, response);
  28. }
  29. }