openview失效
The default implementation determines a bean name from the 4. * given ActionMapping and looks up the corresponding bean in the 5. * WebApplicationContext. 6. * @param mapping the Struts ActionMapping 7. * @return the delegate Action 8. * @throws BeansException if thrown by WebApplicationContext methods 9. * @see #determineActionBeanName 10. */ 11. protected Action getDelegateAction(ActionMapping mapping); throws BeansException { 12. WebApplicationContext wac = getWebApplicationContext(getServlet();, mapping.getModuleConfig(););; 13. String beanName = determineActionBeanName(mapping);; 14. return (Action); wac.getBean(beanName, Action.class);; 15. } 16. 17. /** 18. * Fetch ContextLoaderPlugIn's WebApplicationContext from the 19. * ServletContext, containing the Struts Action beans to delegate to. 20. * @param actionServlet the associated ActionServlet 21. * @param moduleConfig the associated ModuleConfig 22. * @return the WebApplicationContext 23. * @throws IllegalStateException if no WebApplicationContext could be found 24. * @see DelegatingActionUtils#getRequiredWebApplicationContext 25. * @see ContextLoaderPlugIn#SERVLET_CONTEXT_PREFIX 26. */ 27. protected WebApplicationContext getWebApplicationContext( 28. ActionServlet actionServlet, ModuleConfig moduleConfig); throws IllegalStateException { 29. return DelegatingActionUtils.getRequiredWebApplicationContext(actionServlet, moduleConfig);; 30. } /** * Return the delegate Action for the given mapping. *
The default implementation determines a bean name from the * given ActionMapping and looks up the corresponding bean in the * WebApplicationContext. * @param mapping the Struts ActionMapping * @return the delegate Action * @throws BeansException if thrown by WebApplicationContext methods * @see #determineActionBeanName */ protected Action getDelegateAction(ActionMapping mapping); throws BeansException { WebApplicationContext wac = getWebApplicationContext(getServlet();, mapping.getModuleConfig(););; String beanName = determineActionBeanName(mapping);; return (Action); wac.getBean(beanName, Action.class);; } /** * Fetch ContextLoaderPlugIn's WebApplicationContext from the * ServletContext, containing the Struts Action beans to delegate to. * @param actionServlet the associated ActionServlet * @param moduleConfig the associated ModuleConfig * @return the WebApplicationContext * @throws IllegalStateException if no WebApplicationContext could be found * @see DelegatingActionUtils#getRequiredWebApplicationContext * @see ContextLoaderPlugIn#SERVLET_CONTEXT_PREFIX */ protected WebApplicationContext getWebApplicationContext( ActionServlet actionServlet, ModuleConfig moduleConfig); throws IllegalStateException { return DelegatingActionUtils.getRequiredWebApplicationContext(actionServlet, moduleConfig);; } 仔細看其中的取wac的程式碼,它並不是從WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE取的wac。 由此,我相信,除了robbin講的修改原始碼以外,同時使用ContextLoaderListener和ContextLoaderPlugIn,但是不要在ContextLoaderPlugIn裡面加入applicationContext.xml,只要加入你的action-servlet.xml,我相信,同樣也可以非常流暢的使用OpenSessionInView
相關文章
- openview功能簡介(轉載)View
- 使index失效Index
- 8 返回失效
- scrapy軟連線失效和pip軟連線失效
- 面試官:聊聊索引失效?失效的原因是什麼?面試索引
- laravel 登入失效Laravel
- css失效問題CSS
- pyautogui點選失效GUI
- 索引失效場景索引
- Oracle索引失效-likeOracle索引
- vue style樣式失效Vue
- MyBatis order by失效問題MyBatis
- 外掛失效問題
- React中的css失效ReactCSS
- oracle編譯物件失效Oracle編譯物件
- Sqoop fetchsize失效OOP
- EM 失效的處理
- 隱藏檔案失效
- [資料庫]索引失效資料庫索引
- MySql ORDER BY索引是否失效MySql索引
- CSS 右內邊距失效CSS
- CSS 右外邊距失效CSS
- mysql索引失效的情況MySql索引
- IOS繫結touchend事件失效iOS事件
- 如何檢視失效的物件物件
- logmnr找出PACKAGE失效原因Package
- Redis 快取失效機制Redis快取
- 索引失效系列——說說is null索引Null
- 探索MySQL的InnoDB索引失效MySql索引
- vue3 keepalive 失效Vue
- 事務 - 失效的場景
- Textrimming 失效怎麼辦?
- tarui drop失效,解決配置UI
- ORACLE編譯失效物件小結Oracle編譯物件
- MySQL學習筆記:索引失效MySql筆記索引
- 探究 position-sticky 失效問題
- kubernetesgraceperiod失效問題排查
- .gitignore 失效問題解決Git