Migration from Struts 1 to Struts 2

user3018534 picture user3018534 · Nov 21, 2013 · Viewed 23.1k times · Source

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?

Answer

Roman C picture Roman C · Nov 21, 2013

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: