9.ServletConfig对象
来源:互联网 发布:斗鱼发弹幕软件 编辑:程序博客网 时间:2024/06/05 17:48
该对象主要是用于读取servlet的配置信息。
在Servlet的配置文件中,可以使用一个或者多个<init-param>标签为servlet配置一些初始化参数
当servlet配置了初始化参数后,web容器在创建servlet实例对象时,会自动将这些初始化参数封装到ServletConfig对象中,并在调用servlet的init方法时,将ServletConfig对象传递给Servlet。进而,程序员就可以通过ServletConfig对象就可以得到当前servlet的初始化信息
web.xml配置:
以上的配置是针对某个servlet的配置,如果使所有的servlet都应用到配置,可以在servlet节点外进行配置
在servlet中读取参数
阅读ServletConfig API,并举例说明该对象的作用
【1】获得字符集编码
【2】获得数据库连接信息
【3】获得配置文件,查看struts案例的web.xml文件
0 0
- 9.ServletConfig对象
- ServletConfig对象
- ServletConfig对象
- ServletConfig对象
- ServletConfig对象
- ServletConfig对象
- ServletConfig对象
- ServletConfig对象
- servletConfig对象
- ServletConfig对象
- ServletConfig对象
- ServletConfig对象
- ServletConfig对象
- ServletConfig对象
- ServletConfig对象
- ServletConfig对象
- ServletConfig对象
- ServletConfig对象
- 在家你懂的貌晾够讼澈戳颐蘸蔚磁于
- ASP.NET MVC Json()处理大数据异常解决方法
- Perl Learning 8 Processing Text with Regular Expression
- python中的循环语句
- grails g:formRemote 与 ajax 对比
- 9.ServletConfig对象
- Android 游戏存档位置分析
- 浅谈EXT.NET布局
- 图解正向代理、反向代理、透明代理
- CentOS系统下的Hadoop集群(第3期)_VSFTP安装配置
- nmap 常用命令总结
- 嵌入式Ramdisk
- hdu 1102 Constructing Roads(kruskal || prim)
- 平衡二叉树及物理逻辑地址