1、servletConfig:

  在Servlet的配置文件中,可以使用一个或多个<init-param>标签为servlet配置一些初始化参数。(配置在某个servlet标签或者整个web-app下)

这里要补充一点Servlet的配置信息不止可以配置文件中,还可以通过注解的方式进行配置,如下面代码所示

@WebServlet(name = "/ServletForInitParamsDemo01",urlPatterns={"/ServletForInitParamsDemo01","/ServletForInitParamsDemo02"},
initParams={@WebInitParam(name="admin",value="kitty"),
@WebInitParam(name="email",value="admin@example.com")}
)
public class ServletForInitParamsDemo01 extends HttpServlet {
private static final long serialVersionUID = 1L;
private transient ServletConfig config; public void init(ServletConfig config) throws ServletException {
this.config = config;
} protected void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
ServletContext sc = config.getServletContext();
String admin = config.getInitParameter("admin");
String email = config.getInitParameter("email");
sc.setAttribute("admin", admin);
sc.setAttribute("email", email);
PersonInfo personInfo = new PersonInfo();
personInfo.setName("Tom");
personInfo.setAge(22);
personInfo.setSex("男");
personInfo.setHobby("play basketball");
sc.setAttribute("personInfo", personInfo);
response.setContentType("text/html;charset=UTF-8");
PrintWriter pw = response.getWriter();
pw.write("<html><head></head><body>"
+ "<br/>"
+ "admin:"+admin+"<br/>"
+ "email:"+email
+ "</body></html>");
pw.close(); }

  当servlet配置了初始化参数后,web容器在创建servlet实例对象时,会自动将这些初始化参数封装到ServletConfig对象中,并在 调用servlet的init方法时,将ServletConfig对象传递给servlet。进而,程序员通过ServletConfig对象就可以得 到当前servlet的初始化参数信息;

 在开发中主要有三个作用

  •   1)、获取字符集编码:string charset = config.getInitParameter("charset");
  •   2)、获取配置文件中的数据库连接信息:String url = config.getInitParameter("url");
      String username= config.getInitParameter("username");
      String password = config.getInitParameter("password");
  •   3)、获取配置文件:String configFile = config.getInitParameter("config");

  2、servletContext:

  WEB容器在启动时,它会为每个WEB应用程序都创建一个对应的ServletContext对象,它代表当前web应用。

1)ServletContext对象应用1:多个web组件之间使用它实现数据共享

ServletConfig对象中维护了ServletContext对象的引用,开发人员在编写servlet时,可以通过 ServletConfig.getServletContext方法获得ServletContext对象。由于一个WEB应用中的所有Servlet 共享同一个ServletContext对象,因此Servlet对象之间可以通过ServletContext对象来实现通讯。 ServletContext对象通常也被称之为context域对象。

在serlvet中,可以使用如下语句来设置数据共享

ServletContext context = this.getServletContext();  //servletContext域对象
  context.setAttribute("data",
"共享数据"); //向域中存了一个data属性

在另一个servlet中,可以使用如下语句来获取域中的data属性

ServletContext context =
this.getServletContext();
  String value = (String)
context.getAttribute("data");  //获取域中的data属性
  System.out.println(value);

2)通过servletContext对象获取到整个web应用的配置信息

String url =
this.getServletContext().getInitParameter("url");

String username =
this.getServletContext().getInitParameter("username");
  String password =
this.getServletContext().getInitParameter("password");

public class SimpleServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
private ServletConfig config; public SimpleServlet() {
System.out.println("SimpleServlet...");
} public void init(ServletConfig config) throws ServletException {
this.config = config;
System.out.println("SimpleServlet的init方法....");
} public void service(HttpServletRequest request, HttpServletResponse response){
String name = config.getInitParameter("name");
System.out.println(name); ServletContext context = config.getServletContext();
String name1 = context.getInitParameter("name");
System.out.println(name1);
} protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter pw = response.getWriter();
pw.write("<html>"
+ "<head></head>"
+ "<body>"
+ "SimpleServlet"
+ "</body>"
+ "</html>");
} protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException { } }

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
<context-param>
<param-name>name</param-name>
<param-value>Bob</param-value>
</context-param>
<servlet>
<servlet-name>SimpleServlet</servlet-name>
<servlet-class>com.servlet.demo01.SimpleServlet</servlet-class>
<init-param>
<param-name>name</param-name>
<param-value>Tirry</param-value>
</init-param>
<load-on-startup>30</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>SimpleServlet</servlet-name>
<url-pattern>/SimpleServlet</url-pattern>
</servlet-mapping> <servlet>
<servlet-name>WelcomeServlet</servlet-name>
<servlet-class>com.servlet.demo01.WelcomeServlet</servlet-class>
<init-param>
<param-name>name</param-name>
<param-value>Marry</param-value>
</init-param>
<load-on-startup>20</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>WelcomeServlet</servlet-name>
<url-pattern>/WelcomeServlet</url-pattern>
</servlet-mapping>
</web-app>

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAABjkAAAEDCAIAAADoWfHuAAAgAElEQVR4nO3dTa8lyV3n8XwlSCwssUFiMUgox2+AF+CVFyBGxHJ2yOMVYhasLE2M1LZlhCVGqGQbGgybYNEYAw3dY7ef2m0bu8M2dj+43E/VVXXrtksaTMwiMyPj4R+RkefkOTfPvd+PSnbVuZkZkZF5Tlf+6h9xup/+7IPhl/n7rzkAAAAAAABgO0+fPn399dfv37//3nvvvR94+PDh8L/eo0ePHj9+3JFVAQAAAAAA4ETIqgAAAAAAALAXZFW4TYzr1E33IaM613Wu65yJX7daeBFWH3URj9xdOBrXaCOlNwIAAAAAxPaTVVnXZ48xw4Ni17mud/aAQ0q7y8eUWnfOGTVu3OtaQ/4ZbLGf4pbtpyk3VOj8XXTOrMq6vn3MpY0vNweZ79jOKX8CqwakfvCNsqr5/dIdeMwzXaMjhy7f3QQnvnjuG124JudsCwAAAMCl2jyrsk4VYh3dl5+djOt6Z5PHGOt6Ne9bT4vEngi7m/nJc36mFVs/qNH2XRa6tGp3qfNNrOuDzEvdgmfIi8qqLpTVhVB1l1nVZYz55lnVoPHtQFYFAAAAYF9KWdXV1dX19fXV1dX6rEoXHkS0ln8f7lt6jDHqqMdXv7tRc5Y0ZGdRNBb+0RxSzKX7oMxkKssSz8hvWelSy+5y5yVhLYxQnGWctlEdilgElPx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rbfevn//rTffvP/KK9/95jdffulr33jxxa/+8/MvfOkf/mltXZUyrjIHsHEV9ptEVgUAAAAAAHBmT58+/fznP//GG288evTowYP333333Xfeefftt9/50Y9+/OqrP/zBq/b73//B9773/e9853tf+cpL9+7dW7leVfSyf7Gw5c6QVQEAAAAAAJzZ06dPX3zxxc9//vOf/NQn67/u3bv33HPPVbKq2+aOnCYAAAAAAMB+PH369PXXX79///577733fuDhw4fD/3qPHj16/PgxWRUAAAAAAABOhayq6I6cJgAAAAAAwH6QVRXdkdMEAAAAAADYD7KqojtymgAAAAAAAPtBVlV0R04TAAAAAABgP8iqiu7IaQIAAAAAAOwHWVXRHTlNAAAAAACA/UiyqsePH19Lrq6uyKoAAAAAAABwWklWdX19/Ru/8Rsf+tCHPvShD/3ar/3ahz/8YaXUJz7xievra7IqAAAAAAAAnJZYV/WRj3zkd37ndz7+8Y/fu3fvy1/+MnVVAAAAAAAAOId8vaohrvqDP/iDL3zhC1/72teGoIr1qgAAAAAAAHByQ1b185///MGDB34Z9aurq+vr62effdYHVWRVAAAAAAAAOLkhq3rnnXfef//9R4EnT5588MEHT5488a88fvz46uqKrAoAAAAAAACnMmRVDx48GNKoiqurK7IqAAAAAAAAnNCQVT18+DBPpnw+FYqyqjvy66avEQAAAAAAwF0xZFV5LPXkyZPhfxNkVQAAAAAAADiVIavKM6kSsioAAAAAAACcypBVvd2s++nPPhh+mb//mj8EAAAAAAAAcLyHKwlZ1Wuvvfb888/fu3fvmWeeeeaZZz4ZeCZz7969559//qc//emfP/eN333muQ//4d/yi1935NfvPvPcnz/3jZ8CAAAAAHBnvPDCC5/73Oc+3eBzn/vcCy+88Pbbb2+QVd2/f//evXtvvPHGsMZV3WuvvXbv3r0333zzd5957s33rv/TuV/+J7/4dQd+/dK9/s6jj/4v8yYAAAAAAHfGX/7lX96/f/+DDz64rnry5Mkbb7zxhS98YZus6t133/3Upz51fX19dfXk6urq8eP516NHj/2vhw8fPXjw4MGD9z/zmc+8/fbbH/7Dv/1P5x48/eXPP/jl60/+g1/8usW/fvzoP77z7tMn1x/8l//+mfYJtwAAAAAAXLo//dM//cUvfjEEUldXT6RfV48fXz18+PDhw0ef/exn316fVf1/XNpHCJ3MNZIAAAAASUVORK5CYII=" alt="" />

3)通过servletContext对象实现servlet转发

由于servlet中的java数据不易设置样式,所以serlvet可以将java数据转发到JSP页面中进行处理

this.getServletContext().setAttribute("data","serlvet数据转发");
  RequestDispatcher rd =
this.getServletContext().getRequestDispatcher("/viewdata.jsp");

rd.forward(request,
response);

4)通过servletContext对象读取资源文件

在实际开发中,用作资源文件的文件类型,通常是:xml、properties,而读取xml文件必然要进行xml文档的解析,所以以下例子只对properties文件进行读取(在一个web工程中,只要涉及到写地址,建议最好以/开头)

在web工程中,我们一般来说,是不能采用传统方式读取配置文件的,因为相对的是jvm的启动目录(tomcat的bin目录),所以我们要使用web绝对目录来获取配置文件的地址

读取资源文件的三种方式:

第一种:使用ServletContext的getResourceAsStream方法:返回资源文件的读取字节流

InputStream in =
this.getServletContext().getResourceAsStream("/WEB-INF/classes/db.properties");

Properties prop = new
Properties();

prop.load(in);
  String url =
prop.getProperty("url");

第二种:使用ServletContext的getRealPath方法,获得文件的完整绝对路径path,再使用字节流读取path下的文件

String path =
this.getServletContext().getRealPath("/WEB-INF/classes/db.properties");

String filename =
path.substring(path.lastIndexOf("\\")+1);

//相比第一种方法的好处是:除了可以获取数据,还可以获取资源文件的名称
  FileInputStream in = new
FileInputStream(path);
  Properties prop = new
Properties();
  prop.load(in);
  String url =
prop.getProperty("url");

第三种:使用ServletContext的getResource方法,获得一个url对象,调用该类的openStream方法返回一个字节流,读取数据

URL url =
this.getServletContext().getResource("/WEB-INF/classes/db.properties");

InputStream in =
url.openStream();
  Properties prop = new
Properties();
  prop.load(in);
  String url1 =
prop.getProperty("url");

5)web工程中,不同位置的资源文件的读取方式

一、当资源文件在包下面时
  InputStream in =
this.getServletContext().getResourceAsStream("/WEB-INF/classes/cn/itcast/context/db.properties");

System.out.println(in);
  
  二、资源文件在web-inf下
  in =
this.getServletContext().getResourceAsStream("/WEB-INF/db.properties");

System.out.println(in);
  
  三、资源文件在web工程中
  in =
this.getServletContext().getResourceAsStream("/db.properties");

System.out.println(in);

6)在非servlet程序中如何读取配置文件:用类装载器

1)用类装载方式读取

in =
StudentDao.class.getClassLoader().getResourceAsStream("cn/itcast/context/db.properties");

2)用类装载方式读取,把资源当作url对待

URL url =
StudentDao.class.getClassLoader().getResource("db.properties");

这样可以获得资源文件名称:String path = url.getPath();

3)注意:在线程休眠过程中,即使改动了资源文件,获取到的还是原始内容

解决方案:

URL url =
StudentDao.class.getClassLoader().getResource("db.properties");

String path =
url.getPath();
  
  FileInputStream in = new
FileInputStream(path);
  Properties prop = new
Properties();
  prop.load(in);
  System.out.println(prop.getProperty("url"));

try {
   Thread.sleep(1000*15);

} catch (InterruptedException
e) {
    e.printStackTrace();

}
  in = new
FileInputStream(path);
  prop = new Properties();
  prop.load(in);
  System.out.println(prop.getProperty("url"));

4)注意:用类装载器读取资源文件时,千万要注意,资源文件绝对不能太大,否则极易导致内存溢出

资料来自 于偲鹏 的微博,十分感谢!

servletconfig和servletContext的区别的更多相关文章

  1. Servlet学习笔记(二)之Servlet路径映射配置、Servlet接口、ServletConfig、ServletContext

    Servlet路径映射配置 要使Servlet对象正常的运行,需要进行适当的配置,以告诉Web容器哪个请求调用哪个Servlet对象处理,对Servlet起到一个注册的作用.Servlet的配置信息包 ...

  2. ServletConfig和ServletContext 区别

      ServletConfig和ServletContext 1.ServletContext在整个web应用程序生命周期内存在,用来保存全局对象,整个web应用都可以使用其获取context参数.当 ...

  3. JavaEE:Servlet简介及ServletConfig、ServletContext

    Servlet简介 1.Servlet是sun公司提供的一门用于开发动态web资源的技术*静态web资源:固定数据文件*动态web资源:通过程序动态生成数据文件2.Servlet技术基于Request ...

  4. ServletConfig与ServletContext

    ServletConfig与ServletContext对象详解 一.ServletConfig对象    在Servlet的配置文件中,可以使用一个或多个<init-param>标签为s ...

  5. ServletConfig和ServletContext

    ServletConfig和ServletContext Servlet初始化参数 在Servlet的配置文件web.xml中,可以使用一个或多个<init-param>标签为Servle ...

  6. day05 Servlet 开发和 ServletConfig 与 ServletContext 对象

    day05 Servlet 开发和 ServletConfig 与 ServletContext 对象 1. Servlet 开发入门 - hello world 2. Servlet 的调用过程和生 ...

  7. JaveWeb学习之Servlet(二):ServletConfig和ServletContext

    原文同步发表至个人博客[夜月归途] 原文链接:http://www.guitu18.com/se/java/2018-07-26/20.html 作者:夜月归途 出处:http://www.guitu ...

  8. ServletConfig、ServletContext 的应用

    一.ServletConfig对象及其应用(用的不多) 1. Context和ContextPath:一个web工程,若名为JavaWeb,访问的路径为:http://localhost:8080/J ...

  9. JavaWeb学习笔记:ServletConfig()和ServletContext()

    ServletConfig()和ServletContext() 1.ServletConfig() ServletConfig是一个接口,它由server提供商来实现. ServletConfig封 ...

随机推荐

  1. Android studio 常用插件

    常用插件 GsonFormat 该插件的功能是根据JSON数据生成相应的实体类,插件装好后按Alt+S快捷键呼不出GsonFormat的界面,如果你也遇到类似的问题,就去改一下快捷键吧!我将快捷键改成 ...

  2. bootstrap-9

    图像: bootstrap中有以下几种样式风格: 1.img-responsive:响应式图片,主要针对响应式设计 2.img-rounded:圆角图片 3.img-circle:圆形图片 4.img ...

  3. LVS的调度算法

    LVS的调度算法(Scheduling Method)一共有10种 一.静态方法:仅根据算法本身进行调度 1.rr(Round Robin):轮询 2.wrr(Werghted Round Robin ...

  4. 用正则从html代码中提取图片路径

    $str = '<div align="center"> <img src="http://www.99tyg.com/public/images/e8 ...

  5. Notepad++配置Python开发环境

    1. 安装Python 1 下载 我选择了32位的2.7版本.https://www.python.org/ftp/python/2.7.8/python-2.7.8.msi 2. 安装 安装的时候可 ...

  6. 1、C#入门第一课

    C# 读作C Sharp,所以程序文件的扩展名为.cs 新建项目-窗体应用程序 所谓的Visual C#就是指的可视化编程,主要在设计窗口布置好自己的控件(一些具有一定功能的小部件,例如如可以点击的按 ...

  7. lua加载动态库缺乏相应的系统库

    错误信息: 使用lua测试lm2动态库时,加载时出现如下错误 jfyuan@jfy11-B85M-D2V:~/temp/service/soft/code/ginger_resty/cores/lm2 ...

  8. TOMCAT如何建立两个端口或服务

    近日,一个客户需要将系统放到公网上,局网测试的时候用的8080,但该端口已经被其它应用占用,但又不想更改之前的端口,于是查了下资料,以供后阅 针对客户的这个情况,只是说想增加一个端口,这时只需要去to ...

  9. ./configure,make,make install的作用(转)

    这些都是典型的使用GNU的AUTOCONF和AUTOMAKE产生的程序的安装步骤. ./configure是用来检测你的安装平台的目标特征的.比如它会检测你是不是有CC或GCC,并不是需要CC或GCC ...

  10. WebApi:使用方法名或者控制器名作为接口地址

    今天遇到一个问题:新建的WebApi的项目生成的接口的地址都是以控制器的名字命名的,这样的话,在方法前添加ActionName就不起作用了,但之前一个项目是可以的. 接口代码: public clas ...