web.xml配置文件
来源:互联网 发布:税友软件好用吗 编辑:程序博客网 时间:2024/05/20 10:22
1、spring配置文件加载
<!-- spring文件加载 --><context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:spring/applicationContext*.xml</param-value> </context-param><listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener>
下面这种配置可以参考下,配置多个目录下的配置文件
<context-param><param-name>contextConfigLocation</param-name><param-value>classpath*:spring/*.xml,classpath:org/codehaus/xfire/spring/xfire.xml</param-value></context-param>
2、session过滤器配置
</pre><pre>
<!-- session过滤器配置 --><filter><filter-name>login</filter-name><filter-class>com.llbt.filter.SessionFilter</filter-class></filter><filter-mapping><filter-name>login</filter-name><url-pattern>*.action</url-pattern></filter-mapping><filter-mapping> <filter-name>login</filter-name> <url-pattern>*.do</url-pattern></filter-mapping><filter-mapping> <filter-name>login</filter-name> <url-pattern>*.jsp</url-pattern></filter-mapping>
3、struts2配置
struts2的配置文件struts.xml默认路径是类路径
类路径:web容器的classes目录下,项目工程的sourceFolder(常见的有src,也可自己创建)
修改默认路径,可参见:
http://blog.163.com/wunan_23/blog/static/1955623202011102105925798/
<!-- struts2配置 --> <filter> <filter-name>Struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class> </filter> <filter-mapping> <filter-name>Struts2</filter-name> <url-pattern>*.do</url-pattern> </filter-mapping> <filter-mapping> <filter-name>Struts2</filter-name> <url-pattern>*.action</url-pattern> </filter-mapping>4、log4j配置
<!-- log4j生成日志文件路径配置 --> <context-param><param-name>webAppRootKey</param-name><param-value>project.gold.app</param-value></context-param><context-param><param-name>log4jConfigLocation</param-name><param-value>WEB-INF/classes/log4j.properties</param-value></context-param><listener><listener-class>org.springframework.web.util.Log4jConfigListener</listener-class></listener>
5、session超时配置
-1 表示永不超时 (单位分)
可参照:http://lhp--2006.iteye.com/blog/1312273
<session-config> <session-timeout>-1</session-timeout> </session-config>
6、字符集配置
字符集配置可参见:http://hi.baidu.com/feiyuetengkong/item/c9d8dbdf21a370e2b3f777f2
<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><init-param><param-name>forceEncoding</param-name><param-value>true</param-value></init-param></filter><filter-mapping><filter-name>encodingFilter</filter-name><url-pattern>*.do</url-pattern></filter-mapping><filter-mapping><filter-name>encodingFilter</filter-name><url-pattern>*.jsp</url-pattern></filter-mapping>
7、servlet配置
servlet的一般配置是
<servlet> <servlet-name>ImageServlet</servlet-name> <servlet-class>com.servlet.ImageServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>ImageServlet</servlet-name> <url-pattern>/imageServlet</url-pattern> </servlet-mapping></span>若需要配置web容器启动时候就加载执行的servlet,配置如下:
<servlet><servlet-name>serviceFactoryInitServlet</servlet-name><servlet-class>com.llbt.common.servlet.ServiceFactoryInitServlet</servlet-class><load-on-startup>3</load-on-startup></servlet></span>第一种servlet在被拦截的地址匹配url-pattern时候执行;第二种servlet在web容器启动时候执行。
load-on-startup表示servlet的加载顺序,数值越小,加载优先级越高。
8、springMVC配置
<servlet><servlet-name>springMvc</servlet-name><servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class><init-param><param-name>contextConfigLocation</param-name><param-value>classpath:springMVC.xml</param-value></init-param></servlet><servlet-mapping><servlet-name>springMvc</servlet-name><url-pattern>/</url-pattern></servlet-mapping>
0 0
- Webwork2 WEB.xml配置文件
- Tomcat 配置文件web.xml
- web.xml 配置文件详解
- web.xml 配置文件
- web.xml配置文件总结
- web.xml配置文件
- 配置文件web.xml小结
- Tomcat web.xml配置文件
- web.xml配置文件
- Tomcat web.xml配置文件
- j2ee web.xml配置文件
- 配置文件web.xml详解
- web.xml配置文件详解
- Web.xml 配置文件详解
- web.xml配置文件
- web.xml配置文件
- web.xml配置文件概述
- Tomcat web.xml配置文件
- C++面试题集锦(一)
- GO!自制一款【不丑】的名片
- 第11天 忙碌了一天,静下来记单词~
- 《X战警:逆转未来》热映 破福斯海外开画纪录
- Repairing a Road
- web.xml配置文件
- 数据库如何处理null 值
- 创建多线程应用程序
- NSString 与C++ string字符串的互转
- android开发笔记:常用权限说明
- 对linux平台远程升级的一些构想
- 单一设计模式
- Storyboard的基础知识-界面管理、多View切换、View间数据传递
- 用js模拟鼠标点击事件(事件触发)