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的更多相关文章

  1. spring 整合struts

    1.例子:未被spring整合 struts.xml 的配置文件 <constant name="struts.enable.DynamicMethodInvocation" ...

  2. SSH开发实践part4:Spring整合Struts

    1 好了,前面spring与hibernate的整合开发我们基本上讲完了,现在要开始服务层的开发,也就是处理事务的action,在这里我们需要引入spring与struts的整合.也就是将action ...

  3. Spring整合Struts的两种方式介绍

    1 使用Spring托管Struts Action 该种方式就是将Struts Action也视为一种Bean交给Spring来进行托管,使用时Struts的配置文件中配置的Action的classs ...

  4. 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 使用自动装配

  5. spring整合struts

    整合目标:使用spring的bean管理struts action service. 整合步骤: 一.加入spring 1.加入spring jar包 2.配置web.xml文件 <contex ...

  6. Spring整合struts的配置文件存放问题

    只使用Spring的时候,我把applicationContext.xml是放在项目的src路径下的,这样使用ClassPathXmlApplicationContext很方便嘛 整合了struts之 ...

  7. 【SSH】Spring 整合 Struts

    添加 spring-struts-3.2.9.RELEASE.jar struts-config.xml 添加 <controller> <set-property property ...

  8. Spring入门(四)— 整合Struts和Hibernate

    一.Spring整合Struts 1. 初步整合 只要在项目里面体现spring和 strut即可,不做任何的优化. struts 环境搭建 创建action public class UserAct ...

  9. Spring整合Struts2框架的第二种方式(Action由Spring框架来创建)(推荐大家来使用的)

    1. spring整合struts的基本操作见我的博文:https://www.cnblogs.com/wyhluckdog/p/10140588.html,这里面将spring与struts2框架整 ...

随机推荐

  1. hibernate(一)第一个例子

    一.创建一个java project名为HibernateDemo1 然后导入hibernate包,eclipse中具体操作: 点击菜单栏windows->preferences->jav ...

  2. 如何用Python实现目录遍历

    1. 基本实现 [root@localhost ~]# cat dirfile.py import os path='/tmp' for dirpath,dirnames,filenames in o ...

  3. SQL*Loader之CASE3

    CASE3 1. SQL文件 [oracle@node3 ulcase]$ cat ulcase3.sql set termout off rem Do not clean up table beca ...

  4. Oracle Dataguard之switchover

    Oracle Dataguard的角色转换包含两类:Switchover和Failover.Switchover指主备之间角色转换,主库降为备库,备库升级为主库.而failover则是指主库出现问题时 ...

  5. Bootstrap Magic – 轻松创建自己的 Bootstrap 主题

    Bootstrap Magic 是一款基于 Bootstrap 和 AngularJS 的主题创建工具.您可以轻松地创建您自己的 Twitter Bootstrap 主题,可以立即看到你的内容变化.您 ...

  6. Effeckt.css – CSS3 Transitions & Animations 精妙应用

    CSS3 不仅仅用作界面效果补充,还可以用来替换传统的一些界面实现,而且效果更酷.Effeckt.css 收集了众多精妙的 CSS3 Transitions & Animations 效果应用 ...

  7. [SDK2.2]Windows Azure Virtual Network (1) 概念

    <Windows Azure Platform 系列文章目录> Windows Azure Virtual Network是非常重要的概念,其主要作用有以下两点: 1.将多台Azure V ...

  8. Mybatis在idea中错误:Invalid bound statement (not found)

    学习mybatis的过程中,测试mapper自动代理的时候一直出错,在eclipse中可以正常运行,而同样的代码在idea中却无法成功.虽然可以继续调试,但心里总是纠结原因.百度了好久,终于找到一个合 ...

  9. AndroidDevTools简介

    AndroidDevTools简介 Android Dev Tools官网地址:www.androiddevtools.cn 收集整理Android开发所需的Android SDK.开发中用到的工具. ...

  10. 基于MVC4+EasyUI的Web开发框架经验总结(12)--利用Jquery处理数据交互的几种方式

    在基于MVC4+EasyUI的Web开发框架里面,大量采用了Jquery的方法,对数据进行请求或者提交,方便页面和服务器后端进行数据的交互处理.本文主要介绍利用Jquery处理数据交互的几种方式,包括 ...