1.< context-param>
context-param 元素用来设定web站台的环境参数(context),它包含两个子元素:
param-name和param-value.
< param-name>参数名称< /param-name>
设定Context名称
< param-value>值< /param-value>
设定Context名称的值
配置spring配置文件的位置,使加载时可以找到相应的spring配置文件
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:spring/*.xml</param-value>
</context-param>
此所设定的参数,在JSP网页中可以使用下列方法来取得:
${initParam.param_name}
若在Servlet可以使用下列方法来获得:
String paramName=getServletContext().getInitParamter("param_name");
2.过滤器
filter元素用来声明filter的相关设定.filter元素除了下面介绍的的子元素之外,还包括< servlet>介绍过的<
icon>,< display-name> ,< description>,< init-param>,其用途一样.
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
3.监听器
< listener>
listener元素用来定义Listener接口,它的主要子元素为< listener-class>
< listen-class>Listener的类名称< /listener-class>
<listener>
<listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class>
</listener>
分享到:
相关推荐
web.xml配置详解web.xml配置详解web.xml配置详解web.xml配置详解web.xml配置详解web.xml配置详解web.xml配置详解
web.xml配置文件详解让开发人员更加清楚web.xml是怎么配置。以及各个配置的作用。
为tomcat服务器配置https,tomcat需要设置的server.xml与web.xml配置。可以帮助小白为tomcat服务器配置https协议(域名)。
全面详细讲述web.xml个元素的用途 还有实例哦
Filter过滤器的代码及其web.xml配置代码 很好的解决网页乱码问题,很方便,只要按照名字添加就可以了
web.xml 各属性作用描述 Web.xml 常用元素 <web‐app> ‐name>‐name>定义了WEB 应用的名字 <description></description> 声明WEB 应用的描述信息
web.xml配置汇总(servlet2.3) web.xml配置汇总(servlet2.3) web.xml配置汇总(servlet2.3) web.xml配置汇总(servlet2.3)
java web项目 web.xml配置详解
我自己总结的在b/s项目中的web.xml配置的详细说明
web.xml配置文件详解[文].pdf
部署描述文件 web.xml 配置详解 简单易学
web.xml 配置详解,需要的下载了。。。Web.xml常用元素和在java web规范中说明.按照listner,filter,servlet的顺序初始化
本篇文章主要介绍了Spring mvc的web.xml配置说明,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
全新的java web项目的配置文件,新建的纯净的web.xml文件,没做任何改动,下载就可以使用了。
在web.xml中引入其他xml配置文件的步骤,含引入错误解决。
web.xml的CHM,用web.xml控制Web应用的行为,web.xml的配置详细介绍