Calling REST service in my JSF application

若如初见. 提交于 2019-12-11 01:09:32

问题


I have a legacy application written in JSF 1 but I have this requirement to edit the code and call a rest service in my managed bean prior to displaying the user interface.

I am just not too sure how to implement this? Anyone have idea over this?


回答1:


Actually it isn't an good idea to perform this from @ManagedBean, you in this way mix here presentation and logic. @ManagedBean related more to the presentation layer. In any way you should perform HTTP POST or GET request to your service, get the answer and parse it to get the required values. See this tutorial for complete example: http://www.mkyong.com/java/how-to-send-http-request-getpost-in-java/



来源:https://stackoverflow.com/questions/26878721/calling-rest-service-in-my-jsf-application

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