Struts 1 and 2

产业园区如何高效对接企业技术需求与高校科研成果?.docx 科易网基于AI模型+行业大数据,在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,推出科技创新领域的AI+工具与数智化解决方案,推动科技创新与产业创新智能化发展。 立即下载
FeatureStruts 1Struts 2
Action classesStruts 1 requires(需要) Action classes to extend an abstract base class. Acommon(通用的) problem in Struts 1 is programming to abstract classesinstead of(代替) interfaces.An Struts 2 Action may implement an Action interface, along with other interfaces to enable optional and custom services. Struts 2 provides a base ActionSupport class to implement commonly used interfaces. Albeit, the Action interface is not required. Any POJO object with a execute signature can be used as an Struts 2 Action object.
Threading ModelStruts 1 Actions are singletons(单一的) and must be thread-safe since there will only be one instance of a class to handle all requests for that Action. The singleton strategy places restrictions on what can be done with Struts 1 Actions and requires extra care to develop. Action resources must be thread-safe or synchronized.Struts 2 Action objects are instantiated for each request, so there are no thread-safety issues. (In practice, servlet containersgenerate(产生) many throw-away objectsper(每一) request, and one more object does not impose a performance penalty or impact garbage collection.)
Servlet DependencyStruts 1 Actions have dependencies(依赖) on the servlet API since the HttpServletRequest and HttpServletResponse is passed to theexecute method when an Action is invoked.Struts 2 Actions are not coupled(耦合的) to a container. Most often the servlet contexts arerepresented(代表) as simple Maps, allowing Actions to betested(检测) in isolation(隔离). Struts 2 Actions can still access theoriginal(原有的) request and response, if required. However, other architectural elements reduce or eliminate the need to access the HttpServetRequest or HttpServletResponse directly.
TestabilityA major hurdle(主要障碍) to testing Struts 1 Actions is that theexecute method exposes(自曝) the Servlet API.A third-party extension(三方软件), Struts TestCase, offers a set of mock object for Struts 1.Struts 2 Actions can be tested by instantiating the Action, setting properties, and invoking methods. Dependency Injection support also makes testing simpler.
Harvesting InputStruts 1 uses an ActionForm object to capture(捕获) input. Like Actions, all ActionForms must extend a base class. Since  other JavaBeans cannot be used as ActionForms, developers often createredundant(多余的) classes to capture input. DynaBeans can used as analternative(替代) to creating conventional(传统的) ActionForm classes, but, here too, developers may be redescribing existing JavaBeans.
Struts 2 uses Action properties as input properties, eliminating(排除) the need for a second input object. Input properties may be rich object types which may have their own properties. The Action properties can be accessed from the web pagevia(通过) the taglibs. Struts 2 also supports(支持) the ActionForm pattern, as well as POJO form objects and POJO Actions. Rich object types, including business ordomain(定义域) objects, can be used as input/output objects. The ModelDriven feature simplifies taglb references to POJO input objects.
Expression LanguageStruts 1 integrates(一体化) with JSTL, so it uses the JSTL EL. The EL has basic object graph traversal, butrelatively(相对) weak(较弱) collection and indexed property support.Struts 2 can use JSTL, but the framework also supports a morepowerful(强大的) and flexible(灵活的) expression(表达式) language called "Object Graph Notation Language" (OGNL).
Binding values into viewsStruts 1 uses the standard(标准的) JSPmechanism(机制) for binding objects into the page context for access.Struts 2 uses a "ValueStack" technology(技术) so that the taglibs can access values withoutcoupling(耦合) your view to the object type it is rendering. The ValueStack strategy allowsreuse(重用) of views across a range of types which may have the same property name but different property types.
Type ConversionStruts 1 ActionForm properties are usually all Strings. Struts 1 uses Commons-Beanutils for type conversion. Converters are per-class, and not configurable per instance.Struts 2 uses OGNL for type conversion. The framework includes converters for basic and common object types andprimitives(基本实体).
ValidationStruts 1 supports manual(手动) validation(验证) via avalidate method on the ActionForm, or through an extension(扩展) to the Commons Validator. Classes can have different validation contexts for the same class, but cannot chain to validations on sub-objects.Struts 2 supports manual validation via the validate method and the XWork Validation framework. The Xwork Validation Framework supports chaining validation into sub-properties using the validations defined for the properties class type and the validation context.
Control Of Action ExecutionStruts 1 supports separate(单独的)  RequestProcessors(处理器) (lifecycles) for each module(模块), but all the Actions in the module must share the same lifecycle.Struts 2 supports creating different lifecycles on a per Action basis via Interceptor Stacks.Custom(自定义的) stacks can be created and used with different Actions, as needed. 


成为action 类的不同 
s1:Struts 1要求action继承一个抽象的基类。普遍的问题是struts1用接口抽象类代替接口。
s2:Struts 2实现action接口或是struts提供了一个基类ActionSupport(实现了通用的接口),
                       这个action类不是必须的,任何一个pojo对象用execute 能成为struts的action对象。

线程
s1:struts 1的action是单一的和必须是线程安全的,由于它只有一个类来处理action所有的请求,action必须是线程安全或同步的
s2:Struts 2的action是已经为每个请求实例化了,所以没有线程安全。(servletS容器产生了许多请求对象)

servlet依赖
s1:struts 1的action依赖servlet线程,由于当action被调用的时候httpServletRequest和httpServletResponse是传参给了execute()方法。(测试需要依赖web容器)
s2:struts 2的action不耦合(依赖)这容器,大多数这servlet的上下文被包含在Maps中。(允许action的隔离测试)。

testability
s1:(一个障碍)测试struts 1的action是由execute()自曝的一个servlet线程。一个三方软件,提供了一组mock对象给struts 1
s2:struts 2能被测试通过一个action实例,设置它的属性和调用方法。依赖给与关系 也许简单

harvesting 输入
s1:struts 1用一个actionfrom对象捕获输入,像actions,所有的actionfroms必须继承一个基类,甚至其他的JavaBean不能作为actionform.开发常常给一个多余的类作为捕获输入
DynaBeans能被使用作为一个替换给创建一个常规的actionform类,但是开发人员会重新描述现有的JavaBean
s2:struts 2用action属性作为这输入属性,不需要这第二个输入对象。输入属性赋给了对象类型,这action属性能被访问从这web的标记。struts也支持这actionform格式,
以及pojo表对象和pojo action对象,加强了对象类型,包含了业务和定义对象。能被作为pojo输入输出对象。(action自己的属性封装请求参数,避免了使用其他的输入参数)

绑定值到视图
s1:struts 1使用标准的jsp机制为这绑定对象到页面的上下访问。
s2:struts 2使用了一个 valueStack(值栈) 技术,以至于标记 能访问这值,没有耦合视图和这对象绑定,valueStack 允许在用视图

类型转换
s1:struts 1 actionform属性是通常用字符串,struts 1用 Commons-Beanutils为类型转换
s2:struts 2 是用ONGL转换类型,这框架包含了转换为基本的和通用的类型.基本实体

验证
s1:struts 1 是手动验证通过validate()方法在actionform,或者通过一个扩展的给这通用的Validator。类有不同的验证上下文。
s1:struts 2 支持手动验证通过validate()方法和xwork验证框架。XWork验证框架支持使用对象属性所属的类和验证上下文定义的验证规则来验证对象的子属性

action 执行控制
s1:struts 1支持分开的请求来处理各自的模块,但是在这模块中的action必须分享相同的生命周期
s2:struts 2支持创建不同的生命周期为每个action 通过拦截器栈,自定义拦截能被创建和能被用来不同的actions.




SIC知识(8)--碳化硅的制备难点 6. 器件制造难点:碳化硅器件制造过程中的掺杂步骤需要在高温下完成,且需要采用高温离子注入的方式,这与传统硅基器件的扩散工艺不同。这些步骤需要精密的设备和严格的工艺控制,以确保器件的结构和功能。综上所述,碳化硅的制备难点相较于传统硅基器件主要在于更高的制备温度、更慢的生长速度、晶型控制的复杂性、后加工的难度、外延工艺的低效率以及器件制造的特殊要求和较高的成本。- **数据管理**:需要有效的数据管理系统来跟踪和记录生产过程中的每一个步骤,包括原料的批次、生长条件、加工参数等,以确保产品质量的可追溯性。 阅读详情

相关推荐

携程景点评论数据爬取实战:破解AJAX动态加载与分页参数逆向分析

本文详细介绍了携程景点评论数据爬取的实战经验,重点破解了AJAX动态加载与分页参数逆向分析的技术难题。通过分析`getCommentCollapseList`接口,解析动态参数如`poiId`和`pageIndex`,并实现分页逻辑,帮助开发者高效获取评论数据。文章还提供了完整的Python爬虫代码和反爬策略,适用于数据分析与内容挖掘。

weixin_29098367的博客 674

diff of struts2 and struts1

在Action 实现类方面的对比:Struts 1 要求Action 类继承一个抽象基类;Struts 1 的一个具体问题是使用抽象类编程而不是接口。Struts 2 Action 类可以实现一个Action 接口,也可以实现其他接口,使可选和定制的服务成为可能。Struts 2 提供一ActionSupport 基类去实现常用的接口。即使 Action 接口不是必须实现的,只有一个包含exe...

mqqqvpppm 161

计算机视觉-深度学习图像检测方法梳理

计算机视觉-深度学习图像检测方法梳理 由于之后要转方向啦,趁这段时间整理手中硕士研究方向的一些阅读笔记,这是一篇关于计算机视觉的基础知识梳理 先搞清一些小知识点 首先我们要弄清楚图像分类、目标定位、语义分割、实例分割的区别 a. 图像分类 :给定一张输入图像,图像分类任务旨在判断该图像所属类别; b. 目标定位 :在图像分类的基础上,我们还想知道图像中的目标具体在图像的什么位置,通常是以包围盒的(bounding box)形式; c. 语义分割 :语义分割是目标检测更进阶的任务,目标检测只需要框出每个目

qq_41662991的博客 9953

Struts2_与Struts1比较and基本配置

<br />Struts2有以下优点:在软件设计上struts2没有像struts1那样跟Servlet API和struts API有着紧密的耦合,struts2应用可以不依赖于Servlet API和Struts API,Struts2的这种设计属于无侵入式设计。Struts2提供了拦截器,利用拦截器可以进行AOP编程,实现如权限拦截的功能。Struts2提供了类型转换器,我们可以把特殊的请求参数转换成需要的类型。Struts1中,如果要实现同样的功能,就必须向Struts1的底层实现BeanUtil注

HelloWorld 485

Quest 3开发第一步:搞定Meta账号登录和Oculus软件连不上设备的那些坑(2024实测)

本文详细介绍了Quest 3开发初期的关键步骤,包括Meta账号注册、Oculus软件安装与设备连接等常见问题的解决方案。针对国内开发者遇到的邮箱限制、验证码接收等难题,提供了实用的应对策略,并分享了开发环境配置和常见问题排查技巧,帮助开发者快速搭建Quest 3开发环境。

weixin_30333885的博客 495

赛灵思Xilinx 7系列FPGA硬件设计知识总结

本文讲述了赛灵思7系列FPGA硬件设计的关键点,为使用该系列FPGA提供硬件设计参考。

csdn_dsw的博客 3621

sturts1 and struts2

 Struts作为MVC 2的Web框架,自推出以来不断受到开发者的追捧,得到广泛的应用。作为最成功的Web框架,Struts自然拥有众多的优点:MVC 2模型的使用、功能齐全的标签库(Tag Library)、开放源代码。   但是,正所谓“没有最好,只有更好”,Struts1.x自身也有不少的缺点:需要编写的代码过多,容易引起“类爆炸”、单元测试困难。这些缺点随着Web的发展越来越明显。这

王同林的专栏 1091

UE5与Cesium for Unreal结合:打造高效离线地图解决方案

本文详细介绍了如何利用UE5与Cesium for Unreal结合打造高效离线地图解决方案,特别适用于数字孪生、军事仿真等网络不稳定场景。通过优化配置、数据处理和性能调优,实现TB级地形数据的流畅渲染,并结合实战案例展示了在油田巡检等复杂环境中的应用效果。

weixin_29007135的博客 493

Comparing Struts1 and Struts2

Feature Struts 1 Struts 2 Action classes Struts 1 requires Action classes to extend an abstract base class. A common problem in Struts 1 is programming to abstract classes instead of interface

Jston的专栏 705

5分钟搞定Unity+Visual Studio开发环境配置(含C#游戏开发工作负载)

本文提供了一份详细的Unity与Visual Studio开发环境配置指南,帮助开发者在5分钟内完成C#游戏开发工作负载的设置。从Unity Hub安装到Visual Studio关键组件选择,再到常见问题排查,全面覆盖环境搭建的各个环节,显著提升游戏开发效率。

weixin_29014237的博客 249

华为OD机试真题 新系统【小花获胜的奶茶】

华为OD机试真题 新系统【小花获胜的奶茶】,提供C语言、Java、C++、Python、Go、JavaScript源码实现,并提供完整思路讲解,以及在线OJ模拟做题。华为OD机试真题 【小花获胜的奶茶】多语言题解。

qq_45776114的博客 385

difference between struts1 and struts2

struts2 struts1 difference

216

【Simulink教程案例19】基于simulink的扩频通信系统建模与仿真

扩频是一种应用于数字调制信号的调制技术,可以提高传输信号的带宽。扩频通信具有抗干扰能力强,扩频增益越大,抗干扰能力越强。而且扩频通信具有很强的保密性,扩频后信号近似白噪声,功率谱密度也很低。扩频通信可用于多址通信。扩频调制有如下三个特点:① 扩频后信号的带宽远大于信号所需的带宽② 使用扩频码进行扩频调制,扩频码与信号中的数据相互独立③ 在接收端,通过将接收信号与扩频码的同步副本进行相关,实现解扩。

FPGA/MATLAB学习教程/源码/项目合作开发 2197

Comparing Struts 1 and 2

Feature Struts 1 Struts 2 Action classes Struts 1 requires Action classes to extend an abstract base class. A common problem in Struts 1 is programming to abstract classes instead of i

Tender 1211

蓝牙模块HM-10手册

蓝牙模块HM-10手册,该手册对蓝牙模块HM-10进行了详细的介绍和使用方法以及一些AT指令。

pscad IEEE标准系统搭建说明

pscad IEEE标准系统搭建说明,包含典型的IEEE 9节点、14节点、30节点、39节点和118节点系统。内含标准测试系统的原始数据和潮流结果。

difference between struts1.x and Struts2.x

<br />http://www.geekinterview.com/question_details/64360<br /> eature Struts 1 Struts 2 Action classes Struts1 extends the abstract base class by its action class. The problem with struts1 is that it uses the abstract classes rather than interfaces. W

sony315的专栏 866

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

struts1 and struts2区别()

1) 在Action实现类方面的对比:Struts 1要求Action类继承一个抽象基类;Struts 1的一个具体问题是使用抽象类编程而不是接口。Struts 2 Action类可以实现一个Action接口,也可以实现其他接口,使可选和定制的服务成为可能。Struts 2提供一个ActionSupport基类去实现常用的接口。即使Action接口不是必须实现的,只有一个包含execute方法的P

zsy657917826的专栏 632

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

转:Comparing Struts 1 and 2

Feature Struts 1 Struts 2 Action classes Struts 1 requires Action classes to extend an abstract base class. A common problem in Struts 1 is programming to abstract classes instead of ...

weixin_30646505的博客 137

比较Struts1.x和struts2.0 and struts2.1

<br />Struts实现了MVC模式,结构清晰,使开发者能过关注业务逻辑的实现.在应用Struts框架做项目开发的过程中我们更能体会到这种模式的优越性。下面就简单的谈谈不同Struts版本之间的差异:<br />首先,从web.xml配置文件中所配置的前端控制器谈起.<br />  Struts1.x的前端控制器是一个Servlet;<br />  Struts2的前端控制器是一个filter,Struts2.0中的名字是Filterdispatcher;Struts2.1中的名字是StrutsPrep

mistyGod的"咖啡"世界 956
上一篇: Comparing Struts 1 and 2
下一篇: Json实例:ajax返回多个值
without0815
博客等级 码龄15年 107粉丝 79原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值