• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

display array from servlet

 
Aalok Mishra
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am passing an array from the servlet to the jsp page. The array is coming just fine but when I try to display an element from that array using javascript it doesnot alert it. i am a newbie to javascript hence cann't find out the reason. Can you tell me what should I change in my code so as to get the array element in alert.

Here is my code:

Note: the term ONCLIK is a javascript action


Thanks in Advance!
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65216
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JavaScript knows nothing about the scoped variables that exist on the server. Please read this article to understand how JSPs work.

If you want data accessible form javaScript you'll need to create JavaScript literals or variables that contain it in your markup.
 
Aalok Mishra
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bear!

That really helped a lot and solved my problem. Anyways now i am able to alert those values. I am putting in here the code so that others can take benefit of it.


[ December 30, 2008: Message edited by: Aalok Mishra ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic