首页>代码>java servlet Filter的入门实例源代码下载>/使用过滤器优化后代码/demo3/src/com/sxt/HelloServlet.java
package com.sxt;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class HelloServlet extends HttpServlet {

	/**
	 * Constructor of the object.
	 */
	public HelloServlet() {
		super();
	}

	/**
	 * Destruction of the servlet. <br>
	 */
	public void destroy() {
		super.destroy(); // Just puts "destroy" string in log
		// Put your code here
	}

	/**
	 * The doGet method of the servlet. <br>
	 *
	 * This method is called when a form has its tag value method equals to get.
	 * 
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		response.setContentType("text/html");
		PrintWriter out = response.getWriter();
		out
				.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
		out.println("<HTML>");
		out.println("  <HEAD><TITLE>A Servlet</TITLE></HEAD>");
		out.println("  <BODY>");
		out.print("    This is ");
		out.print(this.getClass());
		out.println(", using the GET method");
		out.println("  </BODY>");
		out.println("</HTML>");
		out.flush();
		out.close();
	}

	/**
	 * Initialization of the servlet. <br>
	 *
	 * @throws ServletException if an error occure
	 */
	public void init() throws ServletException {
		// Put your code here
	}

}
最近下载更多
王华伟  LV19 2022年6月7日
最代码-宋家辉  LV61 2021年5月14日
Y.z.x  LV1 2021年5月12日
wangdongtai  LV31 2020年6月4日
ly3812  LV17 2020年3月26日
13940562934  LV22 2019年10月17日
gangui  LV1 2019年6月19日
daidin  LV11 2019年1月2日
hdhbshs  LV16 2018年12月24日
三生石sh1  LV13 2018年12月24日
最近浏览更多
微信网友_7290996505972736  LV4 2024年12月11日
Mike-胖 2024年10月9日
暂无贡献等级
ling7314  LV4 2023年11月14日
3040205658 2022年10月21日
暂无贡献等级
王华伟  LV19 2022年6月7日
Air不得01 2022年5月4日
暂无贡献等级
采暖11  LV11 2021年12月24日
level  LV5 2021年6月21日
ewewrfas  LV2 2021年5月25日
最代码-宋家辉  LV61 2021年5月14日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友