1

I am working on a legacy web application that uses JSPs, Struts 1 and some parts of Struts 2.

This turned out be heavy in the front end. There are over 100 JSPs corresponding to each page in the web application. Requirement now is to convert this into a single page web application.

Is AngularJS a good option to replace the entire set of JSPs and Struts 1 and 2?

Can someone point me to any documents that help do this?

Roman C
  • 49,761
  • 33
  • 66
  • 176
user811433
  • 3,999
  • 13
  • 53
  • 76
  • There's no generalized way to do this. Basically you'd repurpose your existing actions and service classes as API endpoints and rewrite the entire front end. It's non-trivial. – Dave Newton Feb 27 '17 at 18:04
  • Thank you. I understand that its non-trivial. What kind of API can this be? – user811433 Feb 27 '17 at 18:11
  • 1
    An API that provides the data your app uses on the front-end. When you switch to a client-side model the back-end becomes only a way to get the data you need (and possibly the initial rendering, although that can also come from a CDN). Nutshell: all the data you now render on the server-side has to be exposed via an endpoint the client side can access. – Dave Newton Feb 27 '17 at 18:18
  • any suggestions on what the easiest way is to convert the struts action class methods into api endpoints for angularjs front-end to call? REST services? – user811433 Feb 27 '17 at 18:29
  • 1
    Get whatever data you need and stream it out as JSON. You can use the JSON result type in S2 and serialize directly to the output stream under S1. – Dave Newton Feb 27 '17 at 18:33
  • @user811433 Struts2 is a server-side framework and it's not legacy. – Roman C Mar 11 '17 at 17:07

1 Answers1

0

Yes AngularJS is a good option, but now it's Angular2, the AngularJS (known as Angular 1.x) framework is no longer supported.

If you have some difficulties to understand how to use existing application written in Struts1 or Struts2 you might read this article. And forget about conversion, it will require reincarnation of the whole application.

Resources:

For Struts2 you should use REST plugin to create REST API:

Struts2 + AngularJS:

Community
  • 1
  • 1
Roman C
  • 49,761
  • 33
  • 66
  • 176