Java 从 Struts 1 迁移到 Struts 2
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20127369/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Migration from Struts 1 to Struts 2
提问by user3018534
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?
我计划使用 Struts 1 代码库迁移到 Struts 2。我没有得到任何好的来源来进行此迁移。你能帮忙解决这个问题吗?
回答by Roman C
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.
S1 和 S2 会矫枉过正。这两个框架都很复杂,因此维护成本增加了两倍或更多时间。因此,策略是完全迁移到 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.
两个框架都实现了MVC模式。将应用程序划分为三个应该分别迁移的部分:模型、控制器和视图。顺序并不重要,但在逻辑上暗示遵循 MCV 顺序。您可能不会更改的模型,控制器部分需要重写配置,视图是最困难的部分,您必须将 S1 标签重写为 S2 标签。
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.
将 Struts 1.x 迁移到 Struts 2.x:
您可以在struts1 插件下使用 Struts1 操作。还可以考虑 >阅读现有的迁移指南、解决方案和策略>它们可能对您在迁移过程中有所帮助。映射操作可以>通过约定插件轻松完成。您不能在 Struts2 中使用 Struts1 JSP 标记,但如果您使用相同的应用程序运行两个框架,则可以在 Struts1 中使用它。
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.
将 Struts 与 Spring 集成:
正确和最新的方法是迁移到 Struts2。如果您关心 Struts 被弃用的原因,您可能会阅读这篇文章:Struts 死了吗?第三部分:我无法杀死 Struts(Struts 已被弃用) David Geary。
InfoQ Migration Guide:
InfoQ 迁移指南: