简体   繁体   中英

Angularjs application hosting on J2EE servers instead of Node.js server

First of all, I'm very new to AngularJS please let me know if this is a valid scenario.

For studying purposes, I'm developing test applications on Node.js server which I downloaded from http://nodejs.org using in an AngularSeed project.

I'm planning to put the developed Angularjs files to Tomcat/GlassFish server under WEB-INF folder where all the servlets/jsp files are residing maintaining the J2EE web application structure.

My question is, am I doing something wrong by putting the angularjs libraries/files into the J2EE servers or is there any Risk involved.

Please share your thoughts and help me keep going.

Thanks, JG

Angular is completely separate from the backend. As long as your backend can send AJAX to angular, then angular will work just fine. I've seen angular used with Django(python), RoR(ruby), and PHP. It's most fluent with Node.js simply because they are both javascript frameworks and you can easily serve JSON from node to angular to control your frontend.

Angular isn't a templating engine in a common sense. Its a javascript library that runs completely on the front end. Its populated by data from other sources, typically AJAX.

If you're going to use a Java web server all you need to know is how to make a RESTful API to serve data to angular. You should be well versed in OO programming concepts, because I'm sure, with Java being a strong typed language without dynamic objects, you'll have to create objects to parse and serialize JSON to/from. There is also a less common route as to use XML.

Yes an angular application can be hosted on JEE Server like glassfish/WebLogic/WebSphere. For that war/ear file has to be created using angular files. For a trivial web app (for getting started with angular type project) you may not use any java classes. Your html, css, js files will be simply used as its done with a node server or web server like tomcat (not talking about java container).

For adding dynamic functionalities, binding data to angular views you need data to be fed to your so far static app through Rest Services using java classes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM