AngularJS application with EJB only

江枫思渺然 提交于 2019-12-13 18:18:10

问题


Is it possible to build AngularJS application with only EJB directly without having to expose them as REST services? What I have seen on examples on the web is that in the end you have to use REST services to supply data to AngularJS. Hence you would have to expose your EJB methods as RESTful services to be able to make them work with AngularJS. Is there a way without doing this? Please suggest and provide some help resources if any. We are using EJB 3.1 and IBM WAS 8.5.


回答1:


First, you must have an interface to access your EJB methods.

If you're starting a new project I'd highly recommend using REST or WebSocket approach. Further reading on using WebSockets with AngularJS (although with Wildfly) can be found here: http://mgreau.com/posts/2013/11/11/javaee7-websocket-angularjs-wildfly.html

There is also something called AngularFaces project on github:

https://github.com/stephanrauh/AngularFaces

It requires JSF besides EJB. If you deny using REST I assume you're familiar with JSF framework which is complementary to EJB as they both come from Java EE stack. But be careful, as the author of this creature emphasizes that it's only for Java EE developers who are reluctant to learn AngularJS or I think for legacy projects. Here is more on that:

http://www.beyondjava.net/blog/angularfaces-jsf-beyond-ajax/

Once again - this is not the recommended way.



来源:https://stackoverflow.com/questions/28209311/angularjs-application-with-ejb-only

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!