Accessing a bean through Ajax

Hi,

We are building an application using JSF and Ajax.

In the JSP page contaiing the Ajax code, the user can choose a menu and according to that menu we need to make a database call and show the data.

Currently this is the flow that we are looking at

JSF Page A(Has Ajaxcode) -> calls JSF Page B-> which calls a Bean (Bean C) to get data from database-> returns data to JSF page B.

I am able to get the data from the database as follows:

JSF Page B->Bean C-> returns data to JSF Page B

No problem there.

What i would like to know is, Is there a way that I can invoke the Bean (Bean C) to get get the data directly through a call from the Ajax code?

By using the FacesContext or something like that?

So that i don't need to have an intermediate JSF Page. That way I can do away with Page B and call the bean directly from Page A, like:

Page A-> call to bean-> get data from bean in Page A through Ajax

Any help is greatly appreciated.

PS: I haven't built any of the Ajax code - I have built the JSF Page B and the Bean C.

Thanks.

[1143 byte] By [cs_jsfa] at [2007-11-27 6:18:09]
# 1
hi..i'm also facing same problem..pls post ur sample code if u're able to overcome this problem..thnx in adv
jannuwinoda at 2007-7-12 17:31:53 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
Have you tried any of the frameworks for integrating AJAX and JSF, e.g. ajax4jsf? http://labs.jboss.com/jbossajax4jsf/
RaymondDeCampoa at 2007-7-12 17:31:53 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
You could also use a framework such as DWR (Direct Web Remoting), which will allow you to call bean methods directly using an ajax call in a jsp. We used it in a past project and it's easy to setup and use. Just google "Direct Web Remoting". I think you'll be pleasantly surprised...
Michael_Johnson_COa at 2007-7-12 17:31:53 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...