首页 > 其他 > 详细

servlet_2

时间:2017-09-22 00:31:51      阅读:321      评论:0      收藏:0      [点我收藏+]

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() {

}

}

servlet_2

原文:http://www.cnblogs.com/fanzhengzheng/p/7572124.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!