• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

display array from servlet

 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Sheriff
Posts: 67695
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic