spring 整合 struts
struts配置
objectFactory
在struts.xml添加,用spring工厂管理action对象 <constant name="struts.objectFactory" value="spring" />action的class
以前配置action的时候是<action name="xxxx" class="包名.类名" ></action>现在改为 <action name="xxxx" class="id" ></action> id是在spring中配置的action bean的id 通过id访问,才能实现由spring管理action对象spring配置
当出现ConversionNotSupportedException异常时Caused by: org.springframework.beans.ConversionNotSupportedException:
Failed to convert property value of type [java.util.LinkedHashMap] to required type [java.util.Map] for property 'fieldErrors'原因
如果访问这个action的时候,出现这个错误,那是因为,action bean 配置了autowire="byType"
因为,action是继承ActionSupport,ActionSupport里面有一个属性是fieldErrors,并且有seter方法
所以spring会自动装配fieldErrors,spring用java.util.LinkedHashMap去装配java.util.Map,这在jdk里面是向下转型,但是spring显然更安全,会直接抛出ConversionNotSupportedException
解决方案
将spring的自动装配改为autowire="byName"
查看原文:http://139.129.55.235/2016/05/31/spring-%e6%95%b4%e5%90%88-struts/
spring 整合 struts的更多相关文章
- spring 整合struts
1.例子:未被spring整合 struts.xml 的配置文件 <constant name="struts.enable.DynamicMethodInvocation" ...
- SSH开发实践part4:Spring整合Struts
1 好了,前面spring与hibernate的整合开发我们基本上讲完了,现在要开始服务层的开发,也就是处理事务的action,在这里我们需要引入spring与struts的整合.也就是将action ...
- Spring整合Struts的两种方式介绍
1 使用Spring托管Struts Action 该种方式就是将Struts Action也视为一种Bean交给Spring来进行托管,使用时Struts的配置文件中配置的Action的classs ...
- 8 -- 深入使用Spring -- 7... Spring 整合 Struts 2
8.7 Spring 整合 Struts2 8.7.1 启动Spring 容器 8.7.2 MVC框架与Spring整合的思考 8.7.3 让Spring管理控制器 8.7.4 使用自动装配
- spring整合struts
整合目标:使用spring的bean管理struts action service. 整合步骤: 一.加入spring 1.加入spring jar包 2.配置web.xml文件 <contex ...
- Spring整合struts的配置文件存放问题
只使用Spring的时候,我把applicationContext.xml是放在项目的src路径下的,这样使用ClassPathXmlApplicationContext很方便嘛 整合了struts之 ...
- 【SSH】Spring 整合 Struts
添加 spring-struts-3.2.9.RELEASE.jar struts-config.xml 添加 <controller> <set-property property ...
- Spring入门(四)— 整合Struts和Hibernate
一.Spring整合Struts 1. 初步整合 只要在项目里面体现spring和 strut即可,不做任何的优化. struts 环境搭建 创建action public class UserAct ...
- Spring整合Struts2框架的第二种方式(Action由Spring框架来创建)(推荐大家来使用的)
1. spring整合struts的基本操作见我的博文:https://www.cnblogs.com/wyhluckdog/p/10140588.html,这里面将spring与struts2框架整 ...
随机推荐
- JS生成1000个数字加字母的不重复的随机字符串
周五,快下班了,正收拾东西准备走人,项目经理突然让我给他做个Excel,1000个数字加字母组合的密码,不重复,下班前给. 我直接懵了,Excel不会,估计是要写个什么命令才能生成出来,于是想着有没有 ...
- android 股票数据通过日K获取周K的数据 算法 源码
目前的数据是从新浪接口获取的, http://biz.finance.sina.com.cn/stock/flash_hq/kline_data.php?symbol=sh600000&end ...
- easyuidatagrid中load,reload,loadData的区别。
摘要:datagrid中有load,reload,loadData那三个方式,皆是加载数据的,但又有差别.下面让我们一起来看看: 首先,load方法,比如我已经定义一个datagrid的id为grid ...
- IDEA开发多项目的示例
前言:慢慢习惯用IDEA了,觉得用起来确实还不错,有VS的感觉,但是缺点就是每次启动慢,如果修改以后反应也需要好久,这方面做得不好.但是职能提示个人觉得要比Eclipse好太多.好了现在我用IDEA来 ...
- maven项目部署打包
方法一.把maven依赖的jar包一起打包 http://maven.apache.org/plugins/maven-assembly-plugin/usage.html pom/build中加入以 ...
- How to select Multiple images from UIImagePickerController [duplicate]
accepted You have to use custom imagepicker. And I think ELCImagePickerController is the best option ...
- Android入门(十五)通知
原文链接:http://www.orlion.ga/663/ 1.通知的基本用法 创建通知的步骤,首先需要一个NotificationManager来对通知进行管理,可以调用Context的getSy ...
- poj 2195 Going Home
/* 做网络流的题建图真的是太重要了! 本题是将人所在的位置和房子所在的位置建立边的联系,其中man到house这一条边的流量为 1, 费用为两者的距离 而方向边的流量为 0, 费用为正向边的相反数( ...
- [OpenCV] Samples 11: image sequence
一帧一帧地读取视频流. VideoCapture sequence(file_video); sequence >> image. #include <opencv2/core/co ...
- 从css3书写顺序引出来的border-radius参数
本鱼表示偶已经不会取标题了... 当时写这篇文章主要是想探讨一下优雅降级和渐进增强的区别,按照正常的逻辑思维,不管是降级还是增强,应该对于效果是没什么区别的,因为后者会覆盖前者,但今天无意看到张鑫旭的 ...