-2

I have web application (stable and running) which is build using following technical stack Java, Spring, Hibernate, JSF, HTML, WebSphere 9, Gradle etc

Packaging is done in the form of ear and deploy it on WebSphere

Now I want to change the technical stack and want to replace complete JSF component with AngularJs. Please can someone guide me. How easy it would be ? And What would be the feasible project structure I should follow so I would require minimum efforts to convert my JSF application to AngularJs application ?

Thanks in Advance

Akshay
  • 33
  • 1
  • 7

1 Answers1

2

You're facing a pretty large rewrite effort. Really depending on the size of your existing application. Your app logic would need to be moved either client side into your Angular javascript/typescript, or into your server side API you'll need to build to support the application. This is a pretty big effort. You might be able to pickup some speed / performance improvements in your JSF application by utilizing partial page reloads, or try TurboLinks to speed up page transitions.

See: https://github.com/turbolinks/turbolinks

I've re-platformed a few JSF, and Struts applications as Angular + Java REST API applications successfully. You can keep your hibernate model probably as-is. You'll need to build a REST API to facilitate querying / sending data between the Angular front-end and your Java back-end. The code that's going into your REST controllers can be extracted from your existing backing beans, but ultimately some of it will have to be rewritten in the Angular front-end just depending on how you want the application to work.

The project structure I would probably suggest, is to take your existing hibernate code, add it to a new Jax-RS project. (You could also use Spring MVC, I've never used Spring so not familiar with it's capabilities). And start building an API to provide access to the data your front-end will require. Then, build your Angular front-end as a separate project. It could ultimately be compiled / obfuscated / packaged into your EAR project and deployed along with the rest of your app, or simply hosted as static web content.

Nicholas Hirras
  • 2,592
  • 2
  • 21
  • 28
  • 1
    And you need to add 'owasp' that jsf has by default. https://stackoverflow.com/questions/7722159/csrf-xss-and-sql-injection-attack-prevention-in-jsf – Kukeltje Mar 01 '19 at 07:15
  • And the code from the backing beans should stay untouched, since the code in the backing beans is JSF related. New rest code should be develloped using the already existing services. See https://stackoverflow.com/questions/30639785/jsf-controller-service-and-dao. So effectively you give bad advice. In many, many cases developers blame jsf for hard to refactor code while it is caused by previous developers doing things wrong. My JSF apps are well designed easily maintainable, still perform great, use modern html5, css3, ajax etc... and are secure. – Kukeltje Mar 01 '19 at 18:38
  • @kukeltje he stated he wants to get rid of JSF and replace with Angular? – Nicholas Hirras Mar 04 '19 at 02:36
  • Yes but the code in the frontend JSF managed beans is JSF specific and should not be moved to rest services but newly developed. The code in the backend beans (could be 'JSF managed ones) is called by the front-end managed beans and does not need to be converted to rest but just get other annotations (should get them with JSF too moving to CDI). https://stackoverflow.com/questions/30639785/jsf-controller-service-and-dao If this architecture is not in place, very often developers blame JSF, but they should blame themselves or their predecessor. – Kukeltje Mar 04 '19 at 07:29
  • Sorry, I mixed your answer on this question with a different related one... You are righ, my comment is not applicable here. – Kukeltje Mar 04 '19 at 07:30