从 Struts 1 迁移到 Struts 2 [英] Migration from Struts 1 to Struts 2

查看:63
本文介绍了从 Struts 1 迁移到 Struts 2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我计划使用 Struts 1 代码库迁移到 Struts 2.我没有得到任何好的来源来进行此迁移.你能帮忙解决这个问题吗?

解决方案

S1 和 S2 会大材小用.这两个框架都很复杂,因此维护成本增加了两倍或更多时间.所以,策略是完全迁移到S2.

两个框架都实现了MVC模式.将应用程序划分为三个应该分别迁移的部分:模型、控制器和视图.顺序并不重要,但在逻辑上暗示遵循 MCV 顺序.模型你可能不会改变,控制器部分需要重写配置,视图是最困难的部分,你必须将S1标签重写为S2标签.

<块引用>

将 Struts 1.x 迁移到 Struts 2.x:

您可以在 struts1 插件下使用 Struts1 操作.还可以考虑阅读现有的迁移指南solutionsstrategy 可能会在迁移过程中为您提供帮助.映射操作可以通过 convention plugin 轻松完成.您不能在 Struts2 中使用 Struts1 JSP 标签,但如果您使用同一个应用程序运行两个框架,则可以在 Struts1 中使用它.


<块引用>

将 Struts 与 Spring 集成:

正确且最新的方法是迁移到 Struts2.如果你关心为什么 Struts 被弃用的事情,你可能会读到这个文章:Struts 死了吗?第三部分:我不能杀死 Struts(Struts 是已弃用)David Geary.


<块引用>

InfoQ 迁移指南:


I am planning to migrate to the Struts 2 with the Struts 1 code base. I am not getting any good source to proceed on this migration. Could you please help on this approach?

解决方案

S1 with S2 it will overkill. Both frameworks are complicated, so the maintenance costs increase twice or more time. So, the strategy is to migrate completely to S2.

Both frameworks are implemented MVC pattern. Divide the application on three parts that should migrate separately: Model, Controller, and View. The order is not important, but logically is implied to follow the MCV order. The Model you'd probably not change, the Controller part requires to rewrite the configuration, the View is most difficult part, you have to rewrite S1 tags to S2 tags.

Migrating Struts 1.x to Struts 2.x:

You can use Struts1 actions under the struts1 plugin. Also consider to read the existing migration guide, solutions, and strategy that might help you in the migration process. Mapping actions could be easily done via convention plugin. You can't use Struts1 JSP tags with Struts2, but you can use it in Struts1 if you are running both frameworks with the same application.


Integrate Struts with Spring:

The right and up-to-date approach is to migrate to Struts2. If you concern the things why Struts is deprecated, you might read this article: Is Struts Dead? Part III: I can't kill Struts (Struts is Deprecated) David Geary.


InfoQ Migration Guide:


这篇关于从 Struts 1 迁移到 Struts 2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆