ServletConfig对象
来源:互联网 发布:霸气的句子 知乎 编辑:程序博客网 时间:2024/06/06 05:47
- 在Servlet的配置文件中,可以使用一个或多个<init-param>标签为servlet配置一些初始化参数
<init-param> <param-name>data</param-name> <param-value>12345</param-value></init-param>
- 当servlet配置了初始化参数后,web容器在创建servlet实例对象时,会自动将这些初始化参数封装到ServletConfig对象中,并通过init方法将ServletConfig对象传递给Servlet。
- Servlet对象的作用:获得字符集编码,获得数据库连接信息,获得配置文件
//得到指定的String value = this.getServletConfig().getInitParameter("data");System.out.println(value);//得到多个初始化参数Enumeration e = this.getServletConfig().getInitParameterNames();while(e.hasMoreElements){ String name = (String)e.nextElement(); String value = this.getServletConfig().getInitParameter(name);}
0 0
- ServletConfig对象
- ServletConfig对象
- ServletConfig对象
- ServletConfig对象
- ServletConfig对象
- ServletConfig对象
- ServletConfig对象
- servletConfig对象
- ServletConfig对象
- ServletConfig对象
- ServletConfig对象
- ServletConfig对象
- ServletConfig对象
- ServletConfig对象
- ServletConfig对象
- ServletConfig对象
- ServletConfig对象
- ServletConfig对象
- Python 字符串 转换 整数 浮点数 数字
- Flash builder 编译参数
- 元胞数组的用法
- 黑马程序员———动态类
- Android xml文件解析——14
- ServletConfig对象
- 加秘友营销公告推广【12月1日更新】
- [STL] vector出题
- 第14周 项目3-1 成绩的输入与输出(1)
- java之Lambda表达式
- Cocos2d-x 3.x中解决无法打开文件:“extensions/ExtensionMacros.h”
- c++ switch语句的使用(case 后面可以跟N个语句)
- 黑马程序员———类加载器
- <!DOCTYPE html>很重要