日期:2014-05-16 浏览次数:21043 次
package cn.dzr;
import java.io.IOException;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class MyServlet2 extends HttpServlet
{
private static final long serialVersionUID = 1L;
public MyServlet2()
{
super();
}
@Override
public void destroy()
{
super.destroy();
System.out.println("服务器终止...");
}
@Override
public void init(ServletConfig config) throws ServletException
{
super.init(config);
System.out.println("服务器启动.....");
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
System.out.println("doGet\n\n\n\n\n");
response.getOutputStream().write("Hello,Whai is it!".getBytes());
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
doGet(request,response);
}
}