Search code examples
javarestspring-mvcjerseystruts

Migration Struts 1.x to what?


I have an application that was build with Struts 1.x and her front-end is JSP with FLEX (Action-Script), my idea is to change the front to Angular 6. And my back-end dosen't support REST.

What is the best option to Struts suport REST? I should just add Jersey, or upgrade the entire application to Struts 2.x or even more upgrade to SpringMVC?


Solution

  • It's been a while since I have done Struts 2 work, but as I recall, I designed the system I worked on to have a business layer that would support Struts 2 and/or support a REST API. The idea of having Struts in turn use REST, or in some way implement REST seems a bit convoluted to me.

    I would suggest that you should take your Struts code and use the underpinnings as a basis to write a REST API. Most of the underlying code should be reusable in that effort. And then write your Angular code to use that new REST interface.

    In fact, you may want to approach the problem the way I did: refactor your code to support a business logic layer that gives a solid definition of what you want to allow the upper UI layers to do. Use that as a basis for your existing Struts code as a proof of concept that you can at least support the existing functionality. Then you can use that layer as a basis for the REST API that would be used by an Angular UI. You can then run both, if you want, as users are migrated from one to the other in small sets. This will help with any scaling issues you might encounter in the new code base as well, as opposed to just "flipping a switch" and putting everyone on the new system, just hoping it supports the load.