如何在web.xml配置spring,struts2配置以及过滤器
2013-10-20 15:21
399 查看
web.xml
我们在整合hibernate.cfg.xml,struts.xml之后,Spring如何在web.xml配置内,以及当我们出现了懒加载异常后,为了不改变懒加载的模式,那么我们该如何去做?
1.我们配置完spring之后,那么紧接着就是在web.xml中,配置listener了
<listener>
<listener-class>...................ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>ContextConfigLoaction</param-name>
<param-value>classpath:application*.xml</param-value>
</context-param>
2.我们配置完struts2之后,那么紧接着就是在web.xml中,配置struts2的过滤器了
<filter>
<filter-name>struts2</filter-name>
<filter-class>....StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
3.当我们遇到懒加载异常的时候,又不像改变它的加载模式的时候,这时候,我们就可以在web.xml中配置 OpenSessionInviewFilter过滤器,来解决这个问题了。
<filter>
<filter-name>OpenSessionInviewFilter</filter-name>
<filter-class>......OpenSessionInviewFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>OpenSessionInviewFilter</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping>
我们在整合hibernate.cfg.xml,struts.xml之后,Spring如何在web.xml配置内,以及当我们出现了懒加载异常后,为了不改变懒加载的模式,那么我们该如何去做?
1.我们配置完spring之后,那么紧接着就是在web.xml中,配置listener了
<listener>
<listener-class>...................ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>ContextConfigLoaction</param-name>
<param-value>classpath:application*.xml</param-value>
</context-param>
2.我们配置完struts2之后,那么紧接着就是在web.xml中,配置struts2的过滤器了
<filter>
<filter-name>struts2</filter-name>
<filter-class>....StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
3.当我们遇到懒加载异常的时候,又不像改变它的加载模式的时候,这时候,我们就可以在web.xml中配置 OpenSessionInviewFilter过滤器,来解决这个问题了。
<filter>
<filter-name>OpenSessionInviewFilter</filter-name>
<filter-class>......OpenSessionInviewFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>OpenSessionInviewFilter</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping>
相关文章推荐
- 怎么在web.xml配置spring,struts2配置以及过滤器
- Shiro随笔(1:web.xml中的过滤器配置里,spring是如何关联shiro的)
- Java Web Project 的 web.xml 中 Struts2、Spring 配置与过滤器添加需知
- 如何使用Javaconfig代替web.xml配置spring
- Struts2控制器以及struts.xml与web.xml的配置(1)
- spring整合struts2之web.xml配置
- struts2需要在web.xml中配置的过滤器
- web.xml中配置spring的几种方式 以及 Spring获取Bean的几种方式
- SSH框架整合的时候 在web.xml中需配置的spring信息与struts2的配置信息
- struts2与spring整合web.xml加入的配置
- web.xml配置struts过滤器struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter和FilterDispatcher的区别
- SSH开发环境的配置:web.xml、Spring集成hibernate和Spring集成Struts2
- struts2 2.5以上版本安装中web.xml的配置(包括核心过滤器filter)
- web.xml中配置spring的几种方式 以及 Spring获取Bean的几种方式
- web.xml以及结合Spring配置文件详解
- Struts2 + Spring + Hibernate 整合 web.xml的一般配置
- web.xml中配置spring的几种方式 以及 Spring获取Bean的几种方式
- Spring-property文件配置方法以及如何与工程分离~xml使用${}
- struts2整合spring 时web.xml的配置
- Spring和Struts2配置文件不在默认路径下的web.xml配置方法