org.springframework.web.struts.ContextLoaderPlugIn 和 org.springframework.web.con
来源:互联网 发布:选股器软件 编辑:程序博客网 时间:2024/06/05 15:56
org.springframework.web.struts.ContextLoaderPlugIn 和 org.springframework.web.context.ContextLoaderListener
是视图层加载sping的两种方式。
那么这两种方式谁的优先级高,从容器加载程度上看,是org.springframework.web.context.ContextLoaderListener
那么中方式都被配置在项目中,会使用哪个一个呢?
答案是org.springframework.web.struts.ContextLoaderPlugIn
当然如果你不需要在视图层采用lazy而配置org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
那么你可以两个都配置。
但如果你需要使用,那就会。
我们知道,容器初始化Spring配置文件时,使用getServletContext().setAttribute方法key,value全局保存。
那么当你使用OpenSessionInViewFilter时,他取得的是哪个呢?
其实OpenSessionInViewFilter是sping的Filter,它采用WebApplicationContextUtils的方式获得WebApplicationContext
,但它并不能加载由struts-config.xml文件ContextLoaderPlugIn提供初始化的上下文。
如果你需要在视图层加载一对对....等关联对象。那么就会有
could not initialize proxy - the owning Session was closed
错误。
到此处我们看到,sping在应用程序和OpenSessionInViewFilter之间,加载了不同的上下文。
我们知道OpenSessionInViewFilter下无法获得ContextLoaderPlugIn加载的上下文,那我们可以推算,
应用程序应该加载了ContextLoaderPlugIn上下文,而OpenSessionInViewFilter却加载了ContextLoaderListener的上下文。
才导致视图层session有关闭的问题。
尝试解决此问题,若你配置了两个,则删除ContextLoaderPlugIn的加载方式。
若你只配置了ContextLoaderPlugIn的加载方式,则改成ContextLoaderListener加载方式。
- org.springframework.web.struts.ContextLoaderPlugIn 和 org.springframework.web.con
- org.springframework.web.struts.DelegatingActionProxy
- org.springframework.web.struts.DelegatingRequestProcessor
- org.springframework.web.struts找不到
- 严重: action: null java.lang.ClassNotFoundException: org.springframework.web.struts.ContextLoaderPlugIn
- org.springframework.web.filter.CharacterEncodingFilter
- org.springframework.web.util.IntrospectorCleanupListener
- org.springframework.web.context.ContextLoaderListener
- org.springframework.web.filter.CharacterEncodingFilter
- org.springframework.web.context.ContextLoaderListener
- org.springframework.web.filter.CharacterEncodingFilter .
- org.springframework.web.context.ContextLoaderListener
- org.springframework.web.filter.CharacterEncodingFilter
- org.springframework.web.context.ContextLoaderListener
- org.springframework.web.util.IntrospectorCleanupListener
- org.springframework.web.filter.HiddenHttpMethodFilter
- org.springframework.web.servlet.DispatcherServlet
- org.springframework.web.util.IntrospectorCleanupListener
- Logger.getLogger和 LogFactory.getLog
- 字符编码(ASCII、ANSI、UNICODE及UTF-8编码)
- Android 游戏开发之 SurfaceView
- java中Logger.getLogger(Test.class)
- 加载applicationContext文件的七种方法
- org.springframework.web.struts.ContextLoaderPlugIn 和 org.springframework.web.con
- data = (DataSource)conEnv.lookup("jdbc/mysqlHaoBookShop");
- java main 主函数
- Iterator(迭代器)的一般用法
- JSP里面有关参数传递地疑难 (收藏)
- 小窗口大学问--玩转弹出窗口
- C# 操作Excel单元格格式
- jsp弹出一个窗口,一个对话框
- gdk 鼠标指针