Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Migration from Struts 1 to Struts 2

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?

like image 719
user3018534 Avatar asked Nov 21 '13 17:11

user3018534


People also ask

What is the difference between Struts 1 and Struts 2?

Struts 1 supports separate Request Processors (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.

Are struts outdated?

Struts is a quite old web framework, and it's quite clumsy to write modern AJAX GUIs with it, so there were created better frameworks.


1 Answers

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:

  • Migrating Struts Apps to Struts 2 - Part I
  • Migrating to Struts 2 - Part II
  • Migrating to Struts 2 - Part III

like image 167
Roman C Avatar answered Sep 17 '22 11:09

Roman C