ServletConfig接口介绍
来源:互联网 发布:js获取事件源的值 编辑:程序博客网 时间:2024/06/06 04:15
ServletConfig接口
一个ServletConfig实现类的对象,对应一段web.xml中Servlet的配置信息,接口的类由Tomcat提供,对象由Tomcat创建。
servletConfig可以获得xml文件中servlet标签下的内容
ServletConfig方法
ServletConfig有四个方法:String getServletName():获取的是<servlet-name>中的内容ServletContext getServletContext():获取Servlet上下文对象String getInitParameter(String):通过名称得到初始化参数的值Enumeration getInitParameterNames():得到所有初始化参数名称
Servlet初始化参数
servlet初始化参数设置在web.xml中
使用上述方法可以得到初始化参数
//输出初始化参数p1的值与输出初始化参数名 System.out.println(servletConfig.getInitParameter("p1")); Enumeration e = servletConfig.getInitParameterNames(); while(e.hasMoreElements()){ System.out.println(e.nextElement()); System.out.println(e.nextElement()); }
阅读全文
0 0
- ServletConfig接口介绍
- ServletConfig接口
- ServletConfig接口
- ServletConfig接口
- ServletConfig接口
- ServletConfig和ServletContext接口
- Servlet、ServletConfig接口源码
- ServletConfig和ServletContext接口
- [servlet] 02 ServletConfig接口
- ServletConfig 接口和ServletContext 接口
- ServletConfig 接口和ServletContext 接口
- ServletConfig和ServletContext介绍
- Servlet--ServletConfig接口,GenericServlet类
- Servlet(3)ServletConfig接口的介绍(获取web.xml中某个Servlet中的初始配置参数)
- ServletConfig
- servletConfig
- ServletConfig
- servletconfig
- linux下tar命令解压到指定的目录
- 十大基础排序 · 十 --- 基数排序(稳定)
- PHP连接MySQL数据库的三种方式(mysql、mysqli、pdo)
- 找两个字符串中添加的那个字符
- Android Wi-Fi A/N侧解释
- ServletConfig接口介绍
- java序列化深入
- AndroidStudio上面对AIDL的实现
- java后端配合app前端的支付宝和微信支付(逻辑相关代码)
- 课时8 Vi文本编辑器
- Python入门系列——第6篇
- 创建mysql表示例
- 无处不在的算法---《算法神探》读后感
- Comparator 和 Comparable