struts2与spring集成时action的class属性值意义
struts2单独使用时action由struts2自己负责创建;与spring集成时,action实例由spring负责创建(依赖注入)。这导致在两种情况下struts.xml配置文件的略微差异。
假如:LoginAction在包cn.edu.jlu.cs.action中。
1. struts2单独使用时,action的class属性为LoginAction的全路径名,如下:
...
<action name="login" class="cn.edu.jlu.cs.action.LoginAction">
<result name="studentSuccess">
/student/studentindex.jsp
</result>
...
2. struts2与spring集成时,class属性是spring的applicationContext.xml中配置的bean的id属性值。
---------------------------------------------------------------------------------------
//struts.xml
...
<action name="login" class="LoginAction">
<result name="studentSuccess">
/student/studentindex.jsp
</result>
...
----------------------------------------------------------------------------------------
//applicationContext.xml 或者在spring相应的配置文件中
...
<bean id="LoginAction" class="cn.edu.jlu.cs.action.LoginAction" />
struts2与spring集成时action的class属性值意义的更多相关文章
- struts2中action的class属性值意义
整合了spring就不同了,orz struts2单独使用时action由struts2自己负责创建:与spring集成时,action实例由spring负责创建(依赖注入).这导致在两种情况下str ...
- struts2与spring集成时,关于class属性及成员bean自动注入的问题
http://blog.csdn.net/sun_zhicheng/article/details/24232129
- struts2与spring整合时需要注意的点
首先我们需要明白spring整合struts2中的什么东西,spring中的核心就是IOC和AOP,IOC是对象的容器,AOP是处理动态代理的;比如spring与hibernate整合时就要用到aop ...
- Struts2和Spring集成
Spring是一个流行的Web框架,它提供易于集成与很多常见的网络任务.所以,问题是,为什么我们需要Spring,当我们有Struts2?Spring是超过一个MVC框架 - 它提供了许多其它好用的东 ...
- Mybatis与Spring集成时都做了什么?
Mybatis是java开发者非常熟悉的ORM框架,Spring集成Mybatis更是我们的日常开发姿势. 本篇主要讲Mybatis与Spring集成所做的事情,让读过本文的开发者对Mybatis和S ...
- Struts2 自定义拦截器时Action无法接收到参数
问题:自定义拦截器,没有添加defaultStack导致Action无法接受到参数 解决办法: 方法一,添加defaultStack,然后在Action中引用 自定义的stack,其实defaultS ...
- Struts2 和 spring mvc的 迭代标签常用属性对比
<s:iterator value="#users" var="u" status="st"> <c:forEach i ...
- struts框架中OGNL表达式的使用之jsp页面获取action中的属性值
在jsp页面中获取action中的值: 1.写一个action类OgnlAction类: 需要注意的地方: 如果在aciton中直接使用ognl表达式,将值存储的值栈中,是不能通过跳转将值传到jsp页 ...
- js点击标签时获取当前标签属性值
document.body.onclick=function(){ var obj = document.elementFromPoint(event.clientX,event.clientY); ...
随机推荐
- delphi 控制 EXCEL 数据透视表
虽说报表多又难做,做报表相当容易. 做报表也可以偷懒的,超级实用又省事.只需要做一个报表,这个报表里面包括几乎所有的数据字段,然后将查询到的数据导出到 excel中,利用excel自带的“数据透视”功 ...
- [三]SpringMvc学习-封装、乱码问题、重定向、转发
1.对象属性自动封装 前台input 用对象的属性名,后台自动会封装为对象,类似struts 2.解决post乱码问题 在web.xml中配置过滤器 <filter> <filter ...
- WEB API 用MemoryStream流做下载功能
刚开始把MemoryStream 放在 var streamResult = new MemoryStream(); HttpResponseMessage response = new HttpRe ...
- NOI 1998 免费馅饼
附题目链接:http://acm.tzc.edu.cn/acmhome/problemdetail.do?&method=showdetail&id=4901 时间限制(普通/Java ...
- git 删除分支和删除文件夹
1.删除分支 1.1查看所有分支: git branch -a 得到结果: 1.2删除HEAD分支 git push origin --delete HEAD 2.删除文件夹 2.1 查看本地分支下的 ...
- 在.net Core 中像以前那样的使用HttpContext.Current
今晚在学习.net Core 的使用 拿来以前项目进行改造最简单的问题就是怎么做到让httpcontext 和以前兼容 ,折腾的很久 终于搞定,纪录一下 .net core中使用了无处不在的注入,看了 ...
- 解决linux redhat6下安装git的问题
今天用到linux上的git安装过程比较曲折,记录一下: 首先会报需要perl rpm -ivh git-1.7.1-14.2.x86_64.rpm warning: git-1.7.1-14.2.x ...
- .net如何自定义config配置文件节点
本文转载:http://www.cnblogs.com/lori/archive/2013/04/03/2997617.html 对于小型项目来说,配置信息可以通过appSettings进行配置,而如 ...
- [React Native] Passing data when changing routes
The way you make HTTP requests in React Native is with the Fetch API. In this video we'll talk about ...
- RHCA442学习笔记-Unit11内存回收
Unit 12 Memory Reclamation 内存回收 学习目标: A. 了解和调整内存回收 ...