- 浏览: 57376 次
- 性别:
- 来自: 北京
最新评论
-
panyong1229:
才开始学习java需要一些例子来充实自己
Java实例一百例 -
liumin1939:
呵呵 看来哥们经验很丰富啊!这是我刚用db2时收藏的,像你说的 ...
DB2数据库事务日志已满问题解决方案 -
智长老:
很多情况下你是force不掉app的,如果这个app占用大量l ...
DB2数据库事务日志已满问题解决方案 -
aoly80:
能给点注释吗
生产者消费者JAVA队列实现 -
theone0358:
恩,今天刚遇到这个问题,把jar包忘记放在lib里了,导致连接 ...
TomCat6.0数据库连接池配置实例(mysql数据库)
Upgrading Struts 1.1 to Struts 1.2.x
jars
I guess its obvious to say you need to replace the jars, but the one people might forget is the new commons-validator.jar for version 1.1.3 of validator.
Also if you want to start using the new validwhen validation rule, then you will need to deploy the antlr.jar as well.
NOTE If your existing app uses the Struts SSLExt library, you must upgrade it as well: http://sslext.sourceforge.net/
tlds
Remember to deploy the new versions of the tld files for struts tags. If you don't you won't be able to use the new tag attributes added.
NOTE The uri's in the struts tlds have changed from jakarta.apache.org/struts to struts.apache.org - however this shouldn't have any impact (see below)
Tag libraries can be configured in one of two ways:
A. If you have configured the tag libraries using entries in the web.xml (see User Guide) then these should continue to work.
B. If you have used the simplified deployment allowed by Servlet 2.3 onwards (see User Guide) then this should also continue to work as versions of the tld's with the old uri have now been included in the struts.jar (and struts-el.jar). Its recommended that for new development that you use the new uri
Struts 1.1 <%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
Struts 1.2.x <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
validator.xml
Change the dtd declaration at the top to refer to the dtd for validator 1.1.3
<!DOCTYPE form-validation PUBLIC
"-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.1.3//EN" " http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd">
validator-rules.xml
Upgrade to the new version of validator-rules.xml.
N.B. One of the changes in the new validator-rules.xml is that the Validation methods' signatures changed from using ActionErrors to ActionMessages. If you have any custom validation methods, remember to change their method signatures to now use ActionMessages.
struts-config.xml
Its not absolutely necessary but you should upgrade to the 1.2 version of the dtd (Note that as well as the version number changing so has the url to struts.apache.org).
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" " http://struts.apache.org/dtds/struts-config_1_2.dtd">
If you do upgrade to the 1.2 version dtd then there are a couple of attributes which have been removed and you will need to remove them from your struts-config:
debug has been removed from the "controller" element.
dynamic has been removed from the "form-bean" element
Also the contextRelative attribute in the "forward" element is now considered "deprecated" and a new module attribute added.
ActionError(s) and ActionMessage(s)
There is some confusion over ActionError and ActionErrors and whats deprecated.
A. ActionError IS deprecated and should be replaced by ActionMessage.
B. ActionErrors IS NOT deprecated. The Struts committers would have liked to have deprecated ActionErrors but because too much of core API depend on it (such as the ActionForm's validate method) it hasn't been. However it may be in the future and, where possible, you should now use ActionMessages in place of ActionErrors.
Theres more on this topic on StrutsDeprecatedActionErrors.
Custom Tags and Validation
Many methods in org.apache.struts.util.RequestUtils and org.apache.struts.util.ResponseUtils are deprecated. Replace RequestUtils.* and ResponseUtils.* with org.apache.struts.taglib.TagUtils.getInstance().*
Replace org.apache.commons.validator.ValidatorUtil with org.apache.commons.validator.util.ValidatorUtils.
<init-param> web.xml configuration
A number of the of init parameter entries (i.e. <init-param>) in the web.xml were marked as deprecated in the Struts 1.1 release and have been removed in Struts 1.2. A list of the init parameters which have been removed is given below (refer to the User Guide for more information on Struts configuration):
mapping - see note on configFactory below
debug - replaced by Commons Logging
bufferSize - moved to <controller> element in the struts-config.xml
content - renamed to contentType and moved to <controller> element in the struts-config.xml
locale - moved to <controller> element in the struts-config.xml
maxFileSize - moved to <controller> element in the struts-config.xml
nocache - moved to <controller> element in the struts-config.xml
multipartClass - moved to <controller> element in the struts-config.xml
tempDir - moved to <controller> element in the struts-config.xml
application - now parameter in the <message-resources> element in the struts-config.xml
factory - moved to <message-resources> element in the struts-config.xml
null - moved to <message-resources> element in the struts-config.xml
N.B. There is a new configFactory init parameter in Struts 1.2 which can be used to set a custom ModuleConfigFactory class. This could be used to initialize default ModuleConfig settings on a struts-wide basis.
<html:form> Tag Attribute Deprecations
The name, scope and type attributes on the <html:form> tag were deprecated in Struts 1.1 and have now been removed in Struts 1.2.
The <html:form> tag was enhanced in Struts 1.1 to automatically create a new ActionForm instance based on the action mapping from the struts-config.xml. However the behaviour associated with the name, scope and type attributes still functioned.
In struts 1.2 you need to remove these attributes from the <html:form> tag in your jsp. If the values for these attributes match what you have in the struts-config.xml for the mapping then just removing them should be the the only action you need to take.
If they are not the same then problems will almost certainly occur when you upgrade to Struts 1.2 and remove the attributes. If, for example, you have pre-filled a form and stored it in a different scope these will no longer be displayed and the form values appear to have been lost. This can be resolved either by changing the scope on the mapping or by storing the form in the correct scope.
MessageResource Bundle Requirement
When the TagUtils class was introduced, it inadvertently added a new minimum requirement for taglib-only uses of Struts (those not using the ActionServlet + struts-config.xml, but only the tag libraries). In several of the Struts tags, the method TagUtils.retrieveMessageResources() is called, which looks for the MessageResource bundle typically configured by the ActionServlet (and placed in application scope). In the case that it cannot be found in any scope, the method attempts to access the moduleConfig object, which for taglib-only users, is null. This leads to a NullPointerException.
To reconcile this issue, it is necessary to create a bundle and put it into one of the scoped variables. This can be done in a custom servlet or in a top level JSP page.
MessageResources bundle = MessageResources.getMessageResources("ApplicationMessages");
pageContext.setAttribute(Globals.MESSAGES_KEY, bundle, PageContext.REQUEST_SCOPE);If done in a custom servlet (and hence application scope) an empty ModuleConfig object must also be created and stuffed in the application scope.
ModuleConfig moduleConfig = new ModuleConfigImpl("");
moduleConfig.freeze();
getServletContext().setAttribute(Globals.MODULE_KEY, moduleConfig);Change Action.perform(...) to Action.execute(...)
In Struts 1.1 the execute(...) method was introduced and perform(...) method deprecated in Action. In Struts 1.1 the deprecated perform(...) method continues to work.
In Struts 1.2.x the deprecated perform(...) method was removed from Action and therefore any Action's which still implement perform(...) rather than execute(...) no longer function and should be changed to implement execute(...).
jars
I guess its obvious to say you need to replace the jars, but the one people might forget is the new commons-validator.jar for version 1.1.3 of validator.
Also if you want to start using the new validwhen validation rule, then you will need to deploy the antlr.jar as well.
NOTE If your existing app uses the Struts SSLExt library, you must upgrade it as well: http://sslext.sourceforge.net/
tlds
Remember to deploy the new versions of the tld files for struts tags. If you don't you won't be able to use the new tag attributes added.
NOTE The uri's in the struts tlds have changed from jakarta.apache.org/struts to struts.apache.org - however this shouldn't have any impact (see below)
Tag libraries can be configured in one of two ways:
A. If you have configured the tag libraries using entries in the web.xml (see User Guide) then these should continue to work.
B. If you have used the simplified deployment allowed by Servlet 2.3 onwards (see User Guide) then this should also continue to work as versions of the tld's with the old uri have now been included in the struts.jar (and struts-el.jar). Its recommended that for new development that you use the new uri
Struts 1.1 <%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
Struts 1.2.x <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
validator.xml
Change the dtd declaration at the top to refer to the dtd for validator 1.1.3
<!DOCTYPE form-validation PUBLIC
"-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.1.3//EN" " http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd">
validator-rules.xml
Upgrade to the new version of validator-rules.xml.
N.B. One of the changes in the new validator-rules.xml is that the Validation methods' signatures changed from using ActionErrors to ActionMessages. If you have any custom validation methods, remember to change their method signatures to now use ActionMessages.
struts-config.xml
Its not absolutely necessary but you should upgrade to the 1.2 version of the dtd (Note that as well as the version number changing so has the url to struts.apache.org).
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" " http://struts.apache.org/dtds/struts-config_1_2.dtd">
If you do upgrade to the 1.2 version dtd then there are a couple of attributes which have been removed and you will need to remove them from your struts-config:
debug has been removed from the "controller" element.
dynamic has been removed from the "form-bean" element
Also the contextRelative attribute in the "forward" element is now considered "deprecated" and a new module attribute added.
ActionError(s) and ActionMessage(s)
There is some confusion over ActionError and ActionErrors and whats deprecated.
A. ActionError IS deprecated and should be replaced by ActionMessage.
B. ActionErrors IS NOT deprecated. The Struts committers would have liked to have deprecated ActionErrors but because too much of core API depend on it (such as the ActionForm's validate method) it hasn't been. However it may be in the future and, where possible, you should now use ActionMessages in place of ActionErrors.
Theres more on this topic on StrutsDeprecatedActionErrors.
Custom Tags and Validation
Many methods in org.apache.struts.util.RequestUtils and org.apache.struts.util.ResponseUtils are deprecated. Replace RequestUtils.* and ResponseUtils.* with org.apache.struts.taglib.TagUtils.getInstance().*
Replace org.apache.commons.validator.ValidatorUtil with org.apache.commons.validator.util.ValidatorUtils.
<init-param> web.xml configuration
A number of the of init parameter entries (i.e. <init-param>) in the web.xml were marked as deprecated in the Struts 1.1 release and have been removed in Struts 1.2. A list of the init parameters which have been removed is given below (refer to the User Guide for more information on Struts configuration):
mapping - see note on configFactory below
debug - replaced by Commons Logging
bufferSize - moved to <controller> element in the struts-config.xml
content - renamed to contentType and moved to <controller> element in the struts-config.xml
locale - moved to <controller> element in the struts-config.xml
maxFileSize - moved to <controller> element in the struts-config.xml
nocache - moved to <controller> element in the struts-config.xml
multipartClass - moved to <controller> element in the struts-config.xml
tempDir - moved to <controller> element in the struts-config.xml
application - now parameter in the <message-resources> element in the struts-config.xml
factory - moved to <message-resources> element in the struts-config.xml
null - moved to <message-resources> element in the struts-config.xml
N.B. There is a new configFactory init parameter in Struts 1.2 which can be used to set a custom ModuleConfigFactory class. This could be used to initialize default ModuleConfig settings on a struts-wide basis.
<html:form> Tag Attribute Deprecations
The name, scope and type attributes on the <html:form> tag were deprecated in Struts 1.1 and have now been removed in Struts 1.2.
The <html:form> tag was enhanced in Struts 1.1 to automatically create a new ActionForm instance based on the action mapping from the struts-config.xml. However the behaviour associated with the name, scope and type attributes still functioned.
In struts 1.2 you need to remove these attributes from the <html:form> tag in your jsp. If the values for these attributes match what you have in the struts-config.xml for the mapping then just removing them should be the the only action you need to take.
If they are not the same then problems will almost certainly occur when you upgrade to Struts 1.2 and remove the attributes. If, for example, you have pre-filled a form and stored it in a different scope these will no longer be displayed and the form values appear to have been lost. This can be resolved either by changing the scope on the mapping or by storing the form in the correct scope.
MessageResource Bundle Requirement
When the TagUtils class was introduced, it inadvertently added a new minimum requirement for taglib-only uses of Struts (those not using the ActionServlet + struts-config.xml, but only the tag libraries). In several of the Struts tags, the method TagUtils.retrieveMessageResources() is called, which looks for the MessageResource bundle typically configured by the ActionServlet (and placed in application scope). In the case that it cannot be found in any scope, the method attempts to access the moduleConfig object, which for taglib-only users, is null. This leads to a NullPointerException.
To reconcile this issue, it is necessary to create a bundle and put it into one of the scoped variables. This can be done in a custom servlet or in a top level JSP page.
MessageResources bundle = MessageResources.getMessageResources("ApplicationMessages");
pageContext.setAttribute(Globals.MESSAGES_KEY, bundle, PageContext.REQUEST_SCOPE);If done in a custom servlet (and hence application scope) an empty ModuleConfig object must also be created and stuffed in the application scope.
ModuleConfig moduleConfig = new ModuleConfigImpl("");
moduleConfig.freeze();
getServletContext().setAttribute(Globals.MODULE_KEY, moduleConfig);Change Action.perform(...) to Action.execute(...)
In Struts 1.1 the execute(...) method was introduced and perform(...) method deprecated in Action. In Struts 1.1 the deprecated perform(...) method continues to work.
In Struts 1.2.x the deprecated perform(...) method was removed from Action and therefore any Action's which still implement perform(...) rather than execute(...) no longer function and should be changed to implement execute(...).
发表评论
-
flashplayer_9_ax_debug
2009-04-29 09:14 1548flashplayer_9 插件 -
JMX 学习文章连接
2008-12-04 15:48 821http://www.blogjava.net/chengan ... -
TomCat6.0数据库连接池配置实例(mysql数据库)
2008-11-25 11:00 4069TomCat6.0数据库连接池配置有几种方式,在这里我只介绍其 ... -
Integer.ValueOf().intValue和Integer.parseInt的区别?
2008-11-20 10:11 4092总的来说,这两种写法的功能是一样的。区别之处,Integer. ... -
AJAX试题
2008-11-19 11:00 26351. AJAX术语是由哪家公司或组织最先提出的? a. Goo ... -
Java中四种XML解析技术之不完全测试(2)
2008-10-14 11:41 1029选择 DOM 还是选择 SAX ? ... -
Java中四种XML解析技术之不完全测试
2008-10-14 11:32 807在平时工作中,难 ... -
Java实例一百例
2008-10-13 20:33 996解压密码:www.ouyaoxiazai.com -
生产者消费者JAVA队列实现
2008-10-10 17:52 2216class SyncQueue...{ privat ... -
java文件操作大全
2008-10-06 11:02 925java文件操作大全ーーfro ... -
去用友面试时出的几道面试题 (含答案)
2008-10-06 10:44 15561.Hashtable和HashMap有什么区别? a.H ... -
java编程题目
2008-10-06 10:34 2121给你一组字符串如:iu7i8hy4jnb2,让你编程输出里面的 ... -
hibernate的联合主键怎么设置?inverse 设置成false 对sql语句有什么影响
2008-10-06 10:33 2643hibernate的联合主键怎么设置?inverse 设置成f ... -
SQL经典面试题及答案
2008-10-06 10:30 21031.一道SQL语句面试题, ... -
xml面试方面问题
2008-10-06 10:29 962xml有哪些解析技术?区别是什么? 答:有DOM,SAX, ... -
Hibernate工作原理及为什么要用?
2008-10-06 10:25 3309原理: 1. 读取并解析配置文件 2. ... -
Spring,hibernate,struts的面试笔试题
2008-10-06 10:18 52001.strust的。 Action是不是 ... -
使用Java 动态代理实现AOP
2008-09-28 16:58 844目前整个开发社区对AOP( ... -
对代理模式与Java动态代理类的理解
2008-09-28 16:12 8791. 代理模式 代理模式的作用是:为其他对象提供一种代理以控 ... -
Hibernate笔试题
2008-09-28 15:45 2877(1)一般情况下,关系数据模型与对象模型之间有哪些匹配关系(多 ...
相关推荐
linux基础进阶笔记,配套视频:https://www.bilibili.com/list/474327672?sid=4493093&spm_id_from=333.999.0.0&desc=1
IMG20241115211541.jpg
GEE训练教程——Landsat5、8和Sentinel-2、DEM和各2哦想指数下载
该资源内项目源码是个人的课程设计、毕业设计,代码都测试ok,都是运行成功后才上传资源,答辩评审平均分达到96分,放心下载使用! ## 项目备注 1、该资源内项目代码都经过严格测试运行成功才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载学习,也适合小白学习进阶,当然也可作为毕设项目、课程设计、作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可用于毕设、课设、作业等。 下载后请首先打开README.md文件(如有),仅供学习参考, 切勿用于商业用途。
基于springboot家政预约平台源码数据库文档.zip
Ucharts添加stack和折线图line的混合图
基于springboot员工在线餐饮管理系统源码数据库文档.zip
新能源汽车进出口数据 1、时间跨度:2018-2020年 2、指标说明:包含如下指标的进出口数据:混合动力客车(10座及以上)、纯电动客车(10座及以上)、非插电式混合动力乘用车、插电式混合动力乘用车、纯电动乘用车 二、新能源汽车进出口月销售数据(分地区、分类型、分 级别) 1、数据来源:见资料内说明 2、时间跨度:2014年1月-2021年5月 4、指标说明: 包含如下指标 2015年1月-2021年5月新能源乘用车终端月度销量(分类型)部分内容如下: 新能源乘用车(单月值、累计值 )、插电式混合动力 月度销量合计(狭义乘用车轿车、SUV、MPV、交叉型乘用车); 月度销量同比增速(狭义乘用车轿车、SUV、MPV、交叉型乘用车); 累计销量合计(狭义乘用车轿车、SUV、IPV、交叉型乘用车); 累计销量同比增速(狭义乘用车轿车、SUV、MPV、交叉型乘用车); 累计结构变化(狭义乘用车轿车、SUV、IPV、交叉型乘用车); 2015年1月-2021年5月新能源乘用车终端月度销量(分地区)内容如下: 更多见资源内
中心主题-241121215200.pdf
内容概要:本文档提供了多个蓝奏云下载链接及其对应解压密码,帮助用户快速获取所需文件。 适合人群:需要从蓝奏云下载文件的互联网用户。 使用场景及目标:方便地记录并分享蓝奏云上文件的下载地址和密码,提高下载效率。 阅读建议:直接查看并使用提供的链接和密码即可。若遇到失效情况,请尝试联系上传者确认更新后的链接。
基于Java web 实现的仓库管理系统源码,适用于初学者了解Java web的开发过程以及仓库管理系统的实现。
资源名称:Python-文件重命名-自定义添加文字-重命名 类型:windows—exe可执行工具 环境:Windows10或以上系统 功能: 1、点击按钮 "源原文"【浏览】表示:选择重命名的文件夹 2、点击按钮 "保存文件夹"【浏览】表示:保存的路径(为了方便可选择保存在 源文件中 ) 3、功能①:在【头部】添加自定义文字 4、功能②:在【尾部】添加自定义文字 5、功能③:输入源字符 ;输入替换字符 可以将源文件中的字符替换自定义的 6、功能④:自动加上编号_1 _2 _3 优点: 1、非常快的速度! 2、已打包—双击即用!无需安装! 3、自带GUI界面方便使用!
JDK8安装包
配合作者 一同使用 作者地址没有次下载路径 https://blog.csdn.net/weixin_52372189/article/details/127471149?fromshare=blogdetail&sharetype=blogdetail&sharerId=127471149&sharerefer=PC&sharesource=weixin_45375332&sharefrom=from_link
GEE训练教程
该资源内项目源码是个人的课程设计、毕业设计,代码都测试ok,都是运行成功后才上传资源,答辩评审平均分达到96分,放心下载使用! ## 项目备注 1、该资源内项目代码都经过严格测试运行成功才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载学习,也适合小白学习进阶,当然也可作为毕设项目、课程设计、作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可用于毕设、课设、作业等。 下载后请首先打开README.md文件(如有),仅供学习参考, 切勿用于商业用途。
基于springboot交通感知与车路协同系统源码数据库文档.zip
基于springboot+vue 雅妮电影票购买系统源码数据库文档.zip
为了更好地理解 HTML5 的拖放功能,我们设计了一个简单有趣的示例:将水果从水果区拖放到购物笼中,实时更新数量和价格,并在所有水果被成功放置后,播放音效并显示提示。
该资源内项目源码是个人的课程设计、毕业设计,代码都测试ok,都是运行成功后才上传资源,答辩评审平均分达到96分,放心下载使用! ## 项目备注 1、该资源内项目代码都经过严格测试运行成功才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载学习,也适合小白学习进阶,当然也可作为毕设项目、课程设计、作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可用于毕设、课设、作业等。 下载后请首先打开README.md文件(如有),仅供学习参考, 切勿用于商业用途。