This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes JSF and the fly likes how to pass a list from javaside into javascript? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » JSF
Reply Bookmark "how to pass a list from javaside into javascript?" Watch "how to pass a list from javaside into javascript?" New topic
Author

how to pass a list from javaside into javascript?

ihsan kocak
Greenhorn

Joined: Mar 14, 2012
Posts: 28
hi all, i have points list in my managed bean and i should pass these into the javascript how can i do this?

Best Regards.
Adolfo Eloy
Ranch Hand

Joined: Mar 21, 2009
Posts: 142


You can use a4j within RichFaces to return a JSON structure through an assync method calling.
Regarding a4j you can use the a4:jsFunction like follows:



action: the method to call assync
data: a getter method defined at myBean (which returns the List parsed with JSONObject or JSONArray)
name: the name of the javascript function to call on your jsp
oncomplete: the javascript function that will receive the JSON data to be processed as you wish

I hope you can use Richfaces on your project, or newer JSF versions.

Another way to use AJAX: take a look at DWR


Adolfo Eloy
Software Developer
OCPJP 6
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: how to pass a list from javaside into javascript?
 
Similar Threads
Servlet Called From Javascript
Equal Symbol Expected?
global variables in Javascript
passing a variable from html/jsp to javascript
parameter from jsp to javascript function?