`
liumin1939
  • 浏览: 56198 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

StrutsUpgradeNotes11to124

阅读更多
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(...).
分享到:
评论

相关推荐

    infrared-remote-candroid studiodemo

    android studio下载

    【新质生产力】新质生产力赋能智能制造数字化解决方案.pptx

    【新质生产力】新质生产力赋能智能制造数字化解决方案.pptx

    基于matlab实现的用于应用布格重力异常数据反演地下异常密度体.rar

    基于matlab实现的用于应用布格重力异常数据反演地下异常密度体.rar

    node-v8.10.0-linux-x64.tar.xz

    Node.js,简称Node,是一个开源且跨平台的JavaScript运行时环境,它允许在浏览器外运行JavaScript代码。Node.js于2009年由Ryan Dahl创立,旨在创建高性能的Web服务器和网络应用程序。它基于Google Chrome的V8 JavaScript引擎,可以在Windows、Linux、Unix、Mac OS X等操作系统上运行。 Node.js的特点之一是事件驱动和非阻塞I/O模型,这使得它非常适合处理大量并发连接,从而在构建实时应用程序如在线游戏、聊天应用以及实时通讯服务时表现卓越。此外,Node.js使用了模块化的架构,通过npm(Node package manager,Node包管理器),社区成员可以共享和复用代码,极大地促进了Node.js生态系统的发展和扩张。 Node.js不仅用于服务器端开发。随着技术的发展,它也被用于构建工具链、开发桌面应用程序、物联网设备等。Node.js能够处理文件系统、操作数据库、处理网络请求等,因此,开发者可以用JavaScript编写全栈应用程序,这一点大大提高了开发效率和便捷性。 在实践中,许多大型企业和组织已经采用Node.js作为其Web应用程序的开发平台,如Netflix、PayPal和Walmart等。它们利用Node.js提高了应用性能,简化了开发流程,并且能更快地响应市场需求。

    基于Yolov5目标检测和deepsort目标跟踪无人机跟踪.zip

    无人机最强算法源码,易于部署和学习交流使用

    数据库课程设计实战.zip

    数据库课程设计后端 使用Springboot + Mybatis + Redis + Maven 数据库课程设计实战.zip,使用到了所有的相关SQL 的操作,如增删改查等,让你可以在一个项目里面,锻炼到所有的数据库相关的知识。项目亲测可以运行,里面含有运行相关的文档,不会的可以丝我请求帮助。 数据库课程设计后端 使用Springboot + Mybatis + Redis + Maven 具体的表和相关的数据如下: 用户(电话号码,密码,身份证号,邮箱,真实姓名,用户类型,性别,地址) 乘客(用户电话号码,乘客身份证号,乘客真实姓名,乘客电话号码,乘客类型,地址) 列车信息(列车编号,车次,列车类型,列车车厢数,列车始发站,列车终点站,列车开车时间,列车到达时间,列车到达日期,列车运行时间,列车状态) 列车座位信息(列车编号,车厢号,座位类型,座位数) 列车经停信息(列车编号,车次,车站编号,车站名,到达时间,总运行时间,开车时间) 订单信息(订单编号,用户电话号码,乘客身份证号码,列车编号,出发站编号,到达站编号,车厢号,座位编号,订单创建时间,订单状态,开车时间)

    咨询的分析方法gl.ppt

    咨询的分析方法gl.ppt

    node-v10.14.0-linux-ppc64le.tar.xz

    Node.js,简称Node,是一个开源且跨平台的JavaScript运行时环境,它允许在浏览器外运行JavaScript代码。Node.js于2009年由Ryan Dahl创立,旨在创建高性能的Web服务器和网络应用程序。它基于Google Chrome的V8 JavaScript引擎,可以在Windows、Linux、Unix、Mac OS X等操作系统上运行。 Node.js的特点之一是事件驱动和非阻塞I/O模型,这使得它非常适合处理大量并发连接,从而在构建实时应用程序如在线游戏、聊天应用以及实时通讯服务时表现卓越。此外,Node.js使用了模块化的架构,通过npm(Node package manager,Node包管理器),社区成员可以共享和复用代码,极大地促进了Node.js生态系统的发展和扩张。 Node.js不仅用于服务器端开发。随着技术的发展,它也被用于构建工具链、开发桌面应用程序、物联网设备等。Node.js能够处理文件系统、操作数据库、处理网络请求等,因此,开发者可以用JavaScript编写全栈应用程序,这一点大大提高了开发效率和便捷性。 在实践中,许多大型企业和组织已经采用Node.js作为其Web应用程序的开发平台,如Netflix、PayPal和Walmart等。它们利用Node.js提高了应用性能,简化了开发流程,并且能更快地响应市场需求。

    2019年电赛无人机题目(B题)OpenMV相关代码

    These're the OpenMV codes written by microPython in 2019 NUEDC. 2019年电赛无人机题目(B题)OpenMV相关代码(原创).zip

    无人机降落TRT版本.zip

    无人机最强算法源码,易于部署和学习交流使用

    熊出没.zip

    熊出没.zip

    基于SpringBoot和Vue的家教信息平台设计与实现.zip

    基于SpringBoot和Vue的家教信息平台设计与实现.zip 有完整的部署指导文档,源码也是完整的,可以直接运行,里面包含了所有的相关步骤。 本文旨在设计和实现一套基于Java技术的家教信息系统,采用Spring Boot框架构建后端服务,MySQL数据库存储数据,Vue.js作为前端框架实现用户界面。该系统旨在解决家教信息管理的问题,包括家教师资信息管理、用户信息管理以及家教入驻等功能。通过综合运用Java、Spring Boot、MySQL和Vue等技术,实现了系统的高效运行和良好的用户体验。系统提供了用户注册、登录、信息查看和编辑等功能,同时支持家教的发布和查看,用户信息的管理以及家教审核的后台管理。家长可以方便地寻找合适的家教老师,家教老师也能够更便捷地管理自己的信息和相关资料。通过本设计,展示了Java技术在现代化家教信息系统中的应用,为家教行业的信息化管理提供了一种有效的解决方案。该系统的设计与实现将为家长、家教老师和用户提供便利,促进家教行业的发展与进步。 关键词:SpringBoot; MySQL; 系统设计; 家教

    利用CNN进行无人售货机的商品识别.zip

    无人机最强算法源码,易于部署和学习交流使用

    node-v11.10.1-linux-armv6l.tar.xz

    Node.js,简称Node,是一个开源且跨平台的JavaScript运行时环境,它允许在浏览器外运行JavaScript代码。Node.js于2009年由Ryan Dahl创立,旨在创建高性能的Web服务器和网络应用程序。它基于Google Chrome的V8 JavaScript引擎,可以在Windows、Linux、Unix、Mac OS X等操作系统上运行。 Node.js的特点之一是事件驱动和非阻塞I/O模型,这使得它非常适合处理大量并发连接,从而在构建实时应用程序如在线游戏、聊天应用以及实时通讯服务时表现卓越。此外,Node.js使用了模块化的架构,通过npm(Node package manager,Node包管理器),社区成员可以共享和复用代码,极大地促进了Node.js生态系统的发展和扩张。 Node.js不仅用于服务器端开发。随着技术的发展,它也被用于构建工具链、开发桌面应用程序、物联网设备等。Node.js能够处理文件系统、操作数据库、处理网络请求等,因此,开发者可以用JavaScript编写全栈应用程序,这一点大大提高了开发效率和便捷性。 在实践中,许多大型企业和组织已经采用Node.js作为其Web应用程序的开发平台,如Netflix、PayPal和Walmart等。它们利用Node.js提高了应用性能,简化了开发流程,并且能更快地响应市场需求。

    (R语言)-6-箱线图的绘制

    (R语言)-6-箱线图的绘制

    麦肯锡-xx联通固定市场举措gl.ppt

    麦肯锡-xx联通固定市场举措gl.ppt

    在PyCharm中配置Python环境步骤

    附件是在PyCharm中配置Python环境步骤,文件绿色安全,请大家放心下载,仅供交流学习使用,无任何商业目的!

    【北京工业大学】集成电路分析与设计实验报告

    本课程实验分为数字集成电路设计实验与全定制设计实验两部分。 实验1—4为基于Cadence的数字集成电路设计实验部分,主要内容为通过一个简单数字低通滤波器的设计、综合、仿真,让学生熟悉数字集成电路前段实际设计流程,以培养学生实际设计集成电路的能力。具体为:实验1Matlab实现数字低通滤波器算法设计。 实验2Linux环境下基本操作。 实验3RTLCompiler对数字低通滤波器电路的综合。 实验4NC对数字低通滤波器电路的仿真。 其中,实验1主要目的是为了展示算法分析的方法和重要性。使用Matlab实现数字滤波器的算法设计和HDL代码生成。由于Matlab工具可以在Windows环境下工作,而其他集成电路EDA工具均需要在linux下工作,故建议本实验在课堂演示和讲述,学生课下练习。实验2的主要目的是学习linux下的基本操作。包括目录管理、文件管理、文件编辑以及文件压缩等在使用集成电路EDA工具时所需要的操作。本实验是实验3和实验4的基础,建议在实验室完成。

    基于Transformer模型构建的聊天机器人python源码+运行说明.zip

    一、简介 基于Transformer模型构建的聊天机器人,可实现日常聊天。 二、系统说明 2.1 功能介绍 使用者输入文本后,系统可根据文本做出相应的回答。 2.2 数据介绍 * 百度中文问答 WebQA数据集 * 青云数据集 * 豆瓣数据集 * chatterbot数据集 由于数据集过大,因此不会上传,如有需要可以在issue中提出。 2.3. 模型介绍(v1.0版本) 基于Transformer模型,使用Python中的keras-transformer包。 训练的参数文件没有上传,如有需要可在issue中提出。 三、注意事项 * keras-transformer包需要自行安装:`pip install keras-transformer`。 * 如果需要实际运行,参数文件放在`ModelTrainedParameters`文件下;`ListData`文件下包含了已经处理好的字典等数据,不需要修改,直接运行Main.py即可。 * 如果需要自行训练,将数据集文件放在`DataSet`文件下。 * `HyperParameters.py`文件中包含了系统所需

Global site tag (gtag.js) - Google Analytics