2

I am considering moving from server-side rendering view technologies like JSP, Struts to client-side rendering view technologies using AngularJS,

A popular Javascript framework for modern browsers.

When we are making this change and what are all the things that I may encounter.

If anybody who are experienced in Spring Web MVC and JSP development and would know how Spring MVC can work together with a client-side Javascript like AngularJS.

Kindly Answer.

MS Ibrahim
  • 1,789
  • 1
  • 16
  • 28
  • Please refer this link for spring rest web service support. [https://spring.io/guides/gs/rest-service/]. Most of the js frameworks like angular transfers data as json. – zumit Aug 24 '15 at 12:07

2 Answers2

4

You have to rewrite the view part using angularJS, and replace the logic from the server with a REST API.

It's often a huge work, and the hardest part is to migrate the existing server-side session management to the browser, because a REST API is stateless.

Toilal
  • 3,301
  • 1
  • 24
  • 32
0

Below is one of the suggested way in which i recently migrated my existing spring MVC web-application in Single page application using AngularJs as client side java-script framework:

1).First you needs to bisect your core business logic which must needs to handle in DB layer,if not done already. i.e. SP's,trigger's,etc...

2).Then for the thing mentioned as hardest by Toilal ("to migrate the existing server-side session management to the browser, because a REST API is stateless"), you can consider Spring Boot as one of the options to build things quickly instead of Spring MVC with fusion of java8 features to yield the JSON response via API's.

3).And than last but not the least, build UI layer with AngularJS in front End encapsulating the data returned by the spring boot API's. Please note that as angular is super power full, you can do most of your business logic at client side,your DB layer just needs to give you the whole bunch of business data to render the screen,other things you can easily handle in angular. Thus, this way by making the DB layer thin and imbibing angular at front end, you can improve performance of your existing application drastically.

You can also check this AngularJS with Spring-mvc useful thread in same context.

Community
  • 1
  • 1
road2victory
  • 486
  • 4
  • 12