ServletConfig 可以做啥
1、获得 servlet配置的servletname
2、获得servlet 配置的 getInitParameter(“keyname”)
3、获得servlet配置的 所有的 key
package cn.jiemoxiaodi.servlet_config; import java.io.IOException;
import java.util.Enumeration; 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 BServlet implements Servlet { private ServletConfig config; public void destroy() { } public ServletConfig getServletConfig() {
return this.config;
} public String getServletInfo() {
return null;
} public void init(ServletConfig config) throws ServletException {
this.config = config;
} public void service(ServletRequest req, ServletResponse res)
throws ServletException, IOException {
// 1\
// System.out.println(this.config.getServletName()+"==="+this.config.getInitParameterNames());
// 2\ System.out.println(this.config.getInitParameter("a"));
// 3\Enumeration em = this.config.getInitParameterNames();
// while (em.hasMoreElements()) {
// String key = (String) em.nextElement();
// System.out.println(key);
// }
// 4\ServletContext sc= this.config.getServletContext(); } }
ServletConfig 可以做啥的更多相关文章
- javaee 导航
tomcate端口设定和服务器虚拟目录设定 静态web 应用和动态web应用 tomcat相关问题 web应用 http 响应 url uri 动态页面 servlet 一个简单的servlet的de ...
- servelt filter listener 的生命周期
1. servlet 当第一次请求一个servlet资源时,servlet容器创建这个servlet实例,并调用他的 init(ServletConfig config)做一些初始化的工作,然后 ...
- JavaWeb学习之Servlet(四)----ServletConfig获取配置信息、ServletContext的应用
[声明] 欢迎转载,但请保留文章原始出处→_→ 文章来源:http://www.cnblogs.com/smyhvae/p/4140877.html [正文] 一.ServletConfig:代表当前 ...
- JavaWeb之Servlet: ServletConfig 与 ServletContext
ServletConfig对象 什么是ServletConfig对象 ServletConfig对象,叫Servlet配置对象.主要用于加载配置文件的初始化参数. 创建时机 ServletConfig ...
- ServletConfig
ServletConfig Servlet配置 比如web程序中的某一个Servlet需要配置一些初始化信息,需要在web.xml中进行配置 <servlet> <servlet-n ...
- 1、Servlet 2、ServletConfig 3、ServletContext 4、HttpUrlConnection
1.Servlet 2.ServletConfig 3.ServletContext 4.HttpUrlConnection 07. 五 / J2EE / 没有评论 一.第一个Servlet的编写 ...
- Servlet入门和ServletConfig、ServletContext
Servlet是一门用于开发动态web资源的技术. 若想开发一个动态web资源,需要完成以下2个步骤: 1)编写一个Java类,实现servlet接口: 2)把开发好的Java类部署到web服务器中. ...
- Servlet容器模型(四)ServletConfig、ServletContext
这两天刚刚回顾了一下servlet中的配置对象ServletConfig.上下文对象ServletContext.多线程相关的知识点,做了一下笔记,如下: 一.Servlet配置对象(ServletC ...
- Servlet第二篇【Servlet调用图、Servlet细节、ServletConfig、ServletContext】
Servlet的调用图 前面我们已经学过了Servlet的生命周期了,我们根据Servlet的生命周期画出Servlet的调用图加深理解 Servlet的细节 一个已经注册的Servlet可以被多次映 ...
随机推荐
- Log4j的ConversionPattern参数的格式含义
Log4j建议只使用四个级别,优先级从高到低分别是ERROR.WARN.INFO.DEBUG#这里定义能显示到的最低级别,若定义到INFO级别,则看不到DEBUG级别的信息了~!log4j.rootL ...
- FineUI小技巧(5)向子窗口传值,向父窗口传值
前言 FineUI中经常会用到启用IFrame的Window控件,这样有助于从物理上进行代码解耦和.IFrame的引入就会涉及传值问题,如何在父窗口和子窗口之间相互传值呢? 向子窗口传值 向子窗口传值 ...
- u盘安装系统教程详解
一.准备阶段 提前准备一个至少1G或以上的u盘,方便好用. 1.制作u盘启动工具 (1)工具下载,推荐IT天空的优启通 下载地址:https://www.itiankong.net/thread-37 ...
- bzoj 1305 dance跳舞
最大流. 首先二分答案,问题转化为x首舞曲是否可行. 考虑建图,对每个人建立三个点,分别表示全体,喜欢和不喜欢. 源点向每个男生全体点连一条容量为x的边. 每个男生整体点向喜欢点连一条容量为正无穷的边 ...
- microsoft docx document operation with Java POI library
microsoft docx document operation with Java POI library combine multiple docx document into one docu ...
- C#算法知识点记录
针对算法的知识点进行记录 简易桶排序 首先看一个简易桶排序,有一串数字,进行从大到小排列.数字间隔不大,使用一维数组来当作桶,进行插入排序. static void Main(string[] arg ...
- jQuery下拉菜单插件Tendina.
插件效果: 下载地址和文档: https://github.com/iprignano/tendina
- JS实现网页批量下载文件,支持PC/手机
//把下载链接放入集合里 var downloadData = new Array{"http://www.empli.com/data1.apk","http://ww ...
- Linux解压,压缩小总结
linux下打包与解压的三种命令 最近在读<鸟歌的Linux私房菜基础篇>,想着总结一下所读知识,有益于理解. Linux下常用的命令有三种 gzip,zcat(用于zip,gzip等) ...
- Node.js入门笔记(6):web开发方法
使用node进行web开发 用户上网流程: 表面上看:打开浏览器--输入网址--跳转--上网. 背后的过程是什么呢? http请求网址到指定的主机--服务器接收请求--服务器响应内容到用户浏览器--浏 ...