0

I would like to get property values from a managedbean.

RichFaces has jsFunction and that allows for accessing managed beans and handle the return data through javascript. How can I do that without RichFaces? I checked the sourcecode of RichFaces but there is to much code to easily understand how it works. I assume they use a filter but am not sure.

Edit: so I do not want to execute the method but only use the returned data in javascript without JSF rendering the complete page. Just like a rest call, just return data. I want to call the getter from the bean and use the data in javascript.

Thanks, Milo

Milo van der Zee
  • 1,031
  • 11
  • 30
  • As per your edit: `` doesn't do that in first place, so your initial question was wrong. I suggest to fix that part instead of adding explanation afterwards. E.g. *"How to abuse a JSF managed bean as a REST webservice?"* (which has also been asked several times before by the way). – BalusC Sep 22 '15 at 12:21
  • I actually do use jsFunction for accessing data on the backend. The oncomplete contains the data in event.data. Works like a charm. But ok, I come to the conclusing that using CDI for injecting the bean in JSF and in Rest is a better approach. – Milo van der Zee Sep 22 '15 at 12:29
  • Standard JSF and all other components also have a (sort of) oncomplete hook. For standard JSF, that's ``. So technically, it's after all exactly the same as RichFaces `` does. – BalusC Sep 22 '15 at 12:38
  • The onevent gives the html to be rendered to replace the dom part. I ended up doing it with CDI @Named and injecting this bean in a REST service. I documented it in https://vanderzee.org/java/article-150924-141729. – Milo van der Zee Sep 24 '15 at 13:08

0 Answers0