This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to call the services of jax-rs from jsf?  RSS feed

 
Girish Velivela
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Everyone,

I have small application in that I used JAX-RS to provide services. Initially I used Jquery and Ajax to call those services and after getting the data I render the page at client-side. But Know I want to use JSF at presentational Layer. How to call those from JSF using Ajax.

Thanks In Advance........:):):)
 
Tim Holloway
Bartender
Posts: 18662
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In JSF version 2, there's a "f:ajax" element that can be incorporated into many of the JSF elements. That element serves as the anchor for AJAX operation. It specifies what javascript event triggers it, what items will be sent (if it's a partial form submit), what items will be re-rendered, and the name of an AjaxListener method on a backing bean which will be invoked when the event occurs.

That's usually what you want, if you're looking at having JSF visual elements send/receive changes. You should be able to do straight jQuery where that doesn't apply.
 
Girish Velivela
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tim,

That's the same I got when went through oracle documentation that we should use AJAX listener in the backing bean but when we are accessing the services which are developed by the Jax-RS we only cosumes them by the URI's that we provide so again from the backing bean writing the Web services client calling getting data is not correct right. So integrating JSF and Jax-rs is bad Idea.
 
Tim Holloway
Bartender
Posts: 18662
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not quite sure what you are looking to do. But I have a webapp that has a Google Map on a JSF webpage. It invokes a web service to get map overlay points which are passed back to the client-side logic via AJAX as an XML datastreak which the client-side logic then parses and appliies to the map.

JSF isn't a web service framework, so I used Spring-Web to handle the web service function. Since Session-scope JSF backing beans are nothing but JSF-managed regular J2EE backing beans, the JSF and Spring Web parts of the app communicate via a shared session-scope bean.

I designed and wrote this app several years ago and it works very well. Nowadays I'd be able to use better tools, such as Apache CXF for my web services manager and would probably use JSON instead of XML, but those are details. Even older JSF and web services had no problems.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!