This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes JSF and the fly likes How to call Javascript function from managed bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "How to call Javascript function from managed bean" Watch "How to call Javascript function from managed bean" New topic
Author

How to call Javascript function from managed bean

Pattamuthu Aru
Greenhorn

Joined: May 25, 2010
Posts: 13
I have managed bean called register bean , actionListener is invoked and from there i need to call a java script function, from the bean method.

I know how to do that in ICEFACES (JAVASCRIPTCONTEXT), is that some thing similar available in JSF?
Please help me how to do that.
Adrian Mitev
Greenhorn

Joined: Sep 15, 2010
Posts: 10
Could you explain the exact use case. In general you can't directly execute a client side script from server side. The only thing you can do is render javascript as result of server side action and this script will be executed after the response is rendered.
Pattamuthu Aru
Greenhorn

Joined: May 25, 2010
Posts: 13
Thanks Adrian.

Yes we cannot execute Client side script from server side, but ICEFACES provides a way to do that.


Ok if it is not available in JSF, then i think rendering the script calling function will do.
Adrian Mitev
Greenhorn

Joined: Sep 15, 2010
Posts: 10
The so called IceFaces way does exaclty the same - adds a javascript to the response so the browser can execute it after it receives the response. The only thing you gain is that the script rendering is out of the box with Icefaces.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to call Javascript function from managed bean
 
Similar Threads
bean not available in scope but accessible thru property
managing Faces-config in jSF ...please explain.
how to call a servlet from jsf managed bean?
managed-property problem
how to trigger a servlet from JSF