struts2整合spring--spring beans对Action类的管理
来源:互联网 发布:交女友软件 编辑:程序博客网 时间:2024/05/16 18:02
struts2文档中说:由struts的name元素对应spring的id元素。
When an object is to be created, it uses the class attribute in the Struts configuration to correspond to theid attribute in the Spring configuration.
测试如下,applicationContext.xml中默认采用component-scan自动遍历beans。在调用Action的方法中加入以下两行代码。
System.out.println(this);System.out.println(ApplicationContextHolder.getApplicationContext().getBean("loginAction"));
情况一:
struts.xml采用包.类名称的形式
<action name="login" class="fpa.action.login.LoginAction" method="login"> <result >jsp/main.jsp</result></action>
Action类采用默认注释
@Componentpublic class LoginAction{...}
连续两次,访问此action,测试结果:
fpa.action.login.LoginAction@7ea991e0
fpa.action.login.LoginAction@2ea84a17
11
fpa.action.login.LoginAction@10cfc2e3
fpa.action.login.LoginAction@2ea84a17
00
结论一:Action类并没有交由spring管理,而是由struts自己new的。
- struts2整合spring--spring beans对Action类的管理
- spring-struts2整合 action的管理
- struts2,spring整合中使用spring 管理struts2的action,springaop 常见问题
- Struts2与Spring整合.让Spring来管理action
- Spring 管理Struts2 Action
- struts2,spring管理action
- Struts2+Spring集成中Action的管理
- Struts2+Spring集成中Action的管理
- Struts2+Spring+iBatis整合用户管理实例之一:多个Action、service的配置
- Struts2+Spring+iBatis整合用户管理实例之一:多个Action、service的配置
- Spring管理Action类和Struts2管理Action类比较
- 【j2ee spring】21、用spring管理Struts2的action不成功?
- Spring整合struts2的action的默认作用域
- Struts2与Spring整合时Action的创建问题
- 单元测试与Spring整合的struts2中的action
- Struts2整合Spring创建的Action同步问题
- Struts2 和spring整合的 Action层托管问题
- struts2与spring整合后Action的配置方式
- java字典树 实现统计
- poj2828
- linux:你不知道的echo
- android开发之滑动效果实现图片浏览_ViewFilpper的使用
- Connection to http://dl-ssl.google.com refused
- struts2整合spring--spring beans对Action类的管理
- linux下五种查找
- 快速预览:C# 3.0的新东西
- vim 多文件窗口打开切换
- unity3d简单血条的制作方法
- C语言中变量的作用域
- MySQL中的datetime与timestamp比较
- 对于CMOS数字电路空闲引脚的处理
- Read an Excel xlsx with PL/SQL