package com.atguigu.servlet;
import java.io.IOException;
import javax.servlet.Servlet;
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
public class AServlet implements Servlet {
public void init(ServletConfig config) throws ServletException {
//获取Servlet的别名
String servletName = config.getServletName();
System.out.println("输出别名:"+servletName);
//获取Servlet的初始化参数
String user = config.getInitParameter("user");
System.out.println("user:"+user);
//获取ServletContext对象
//我们web应用中的所有信息都封装在ServletContext对象,
//每个web应用都对应着唯一的ServletContext
ServletContext context = config.getServletContext();
System.out.println(context);
}
public ServletConfig getServletConfig() {
return null;
}
public void service(ServletRequest req, ServletResponse res)
throws ServletException, IOException {
}
public String getServletInfo() {
return null;
}
//@Override
public void destroy() {
}
}