struts2 与struts1和Spring整合时Bean的配置区别
来源:互联网 发布:傲剑狮子上豹子数据 编辑:程序博客网 时间:2024/04/29 15:19
在STRUTS1中需要自己声明属性即你写的
<property name="itemService" ref="itemService"/>而在STRUTS2中这个完全被框架实现了,你所要做的
只是在UserAction里声明类对象
private UserService uservice;
实现GET 和SET
就可以直接用了,具体注入,由框架自己进行!
在struts1的可以这样配置:
<bean name="/item" class="com.blog.web.actions.ItemAction">
<property name="itemService" ref="itemService"/>
<property name="dataDictService" ref="dataDictService"/>
</bean>
在struts2则只需要在ItemAction中定义
private ItemService itemService;
private DataDictService dataDictService;
并实现相应的GET和SET即可,不需要在applicationContext中再做action的bean配置
但要注意:struts2的action中定义的Service实例名必须与applicationContext中定义的Service的bean id名一致,否则action中的Service instance会初始化失败,调用时会抛出空指针的错误
- struts2 与struts1和Spring整合时Bean的配置区别
- struts1和struts2的整合
- Struts1与Struts2的区别和对比
- spring 配置时 bean id 与bean name 的区别
- spring 配置时 bean id 与bean name 的区别
- spring 配置时 bean id 与bean name 的区别
- spring 配置时 bean id 与bean name 的区别
- spring整合struts2 关于action bean的配置
- Struts1和Spring的整合
- struts1和spring的整合
- Struts1和Spring的整合
- struts1与struts2的区别
- Struts1与Struts2的区别
- Struts1与Struts2的区别
- Struts1与Struts2的区别
- struts1 与 struts2 的区别
- Struts2与Struts1的区别
- struts1 与struts2 的区别
- 通过GC创建dataguard备库失败一则
- IE文档模式
- Java 环境变量配置
- 糊涂窗口综合症
- XMPP——Smack[3]用户列表,头像,组操作,用户操作
- struts2 与struts1和Spring整合时Bean的配置区别
- List和ArrayList的区别
- fatal error C1010: 在查找预编译头时遇到意外的文件结尾。是否忘记了向源中添加“#include "stdafx.h
- Jenkins Master/Slave架构
- Linux下Tomcat的启动、关闭、杀死进程
- MFC各种指针的获取-转载自红黑联盟
- XMPP——Smack[4]状态,心情,头像更改
- 如何获得当前程序的视图,文档指针
- greenplum 表管理及查看分区表占空间大小