struts升级到最高版本后遇到的问题。关于actionmessage传递问题。
Struts2升级到最新版本遇到的一些问题
首先是更换对应的jar,如asm、common、ongl、struts等等。更换后发现系统启动不了,按照网上的介绍,先后又更新了slf4j-log4j12-1.6.1.jar和cglib-2.2.2.jar后,起来了,但运行系统报错:NoSuchMethodError ...context.get(Object),修改web.xml,去掉struts-cleanup和FilterDispatcher,换上StrutsPrepareAndExecuteFilter,运行起来了。
仔细检查发现ongl对get和set的验证比原来严格了,比如原来action里有个变量aMap,方法getaMap()和setaMap()原来能用,现在就不能用了,必须改成getAMap()和setAMap().另外ongl原来允许set和get基本类型int,long等,升级后不再允许了,必须改成Integer、Long等对象类型。
另外遇到的一个问题就是原来有个action的result类型是chain,从前一个action将actionMessage带到下一个action,升级后发现带过来的actionMessage是null,google struts2 result chain actionMessage发现有高人遇到过这个问题,粘贴答案如下:
在网上查询N久,未解决。
一说必须使用 chain Result,我就是用的这个啊。
一说必须使用 chain Interceptor,我用的是 defaultStack,应该默认就有。
一说是需要使用 store Interceptor,感觉不对。
后在 ChainInterceptor 的 JavaDoc 中找到
引用
QUOTE:
By default Errors, Field errors and Message aren't copied during chaining, to change the behaviour you can specify the below three constants in struts.properties or struts.xml:
struts.xwork.chaining.copyErrors - set to true to copy Action Errors
struts.xwork.chaining.copyFieldErrors - set to true to copy Field Errors
struts.xwork.chaining.copyMessages - set to true to copy Action Messages
翻译后:
默认情况下,错误,现场的错误和消息都不会被复制在链接过程中,要改变行为,您可以指定在struts.properties或struts.xml中的下面三个常量:
struts.xwork.chaining.copyErrors - 设置为true,复制操作错误
struts.xwork.chaining.copyFieldErrors - 设置为true,复制字段错误
struts.xwork.chaining.copyMessages - 设置为true,复制行动消息
最新文章
- Android笔记——eclipse快捷键
- StackExchange.Redis 访问封装类
- Python开发【第九章】:堡垒机实例
- 小议map排序问题
- VB的注释
- html之ul标签
- Centos linux php扩展安装步骤
- Android Material Design:NavigationView抽屉导航菜单
- 快速安装多系统(xp与win7)
- 前端开发——移动bug整理
- AtCoder Beginner Contest 069【A,水,B,水,C,数学,D,暴力】
- 昨天开始使用lr controller 已停止工作问题
- shellinabox
- Bacnet协议IP采集开发 总结
- BZOJ2554 color 【概率DP】【期望DP】
- 使用TensorFlow的递归神经网络(LSTM)进行序列预测
- [Socket]Socket聊天小程序
- 学习笔记21—PS换图片背景
- JVM—JVM内存模型
- OneZero第三周第一次站立会议(2016.4.4)
热门文章
- Delphi三层网络架构代码实现
- JS获取浏览器型号
- Android Studio设置自己主动编project
- 在openwrt上编译最简单的一个ipk包文件
- JS中的模块规范(CommonJS,AMD,CMD)
- C# 利用 HttpWebRequest 和 HttpWebResponse 模拟登录有验证码的网站
- 读书笔记—CLR via C#章节8-10
- String.Join的实现
- ibatis提示Unable to load embedded resource from assembly ";Entity.Ce_SQL.xml,Entity";.
- RequireJS 入门指南