• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to pass a list from javaside into javascript?

 
ihsan kocak
Ranch Hand
Posts: 31
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 146
Eclipse IDE Java Linux
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic