• 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
  • Devaka Cooray
  • Tim Cooke
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
Saloon Keepers:
  • Piet Souris
Bartenders:

Assigning Java variable to javascript variable.

 
Ranch Hand
Posts: 419
Mac jQuery Objective C
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I have a list of objects. I am getting that list in jsp using request object.I want to fetch object from java list object then get a value from that object and assign it to a javascript variable. Is it possible? I have tried following code but Its not working. Also If it is possible how much time it will take if list size is 1500?


 
Ranch Hand
Posts: 874
Android VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Pawan,


I have tried following code but Its not working



is useless and doesn't provide any clue to anybody here.

Check your HTML generated by the code ( View source of web browser) and see if you could figure it out.

 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try this





scriptlet in jsp is discourage . set the value into anyscope on servlet . and use EL to read that . Here i use String "Hai"
for example .

Hope this helps
 
Ranch Hand
Posts: 312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What you are trying to do is possible but not recommended. As seetharaman has told you, try to use EL
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When debugging servlet/jsp/javascript applications it is helpful to use a browser such as FireFox with plugins which let you see EXACTLY what the browser request is actually getting and the JavaScript structures being created.

Bill
 
reply
    Bookmark Topic Watch Topic
  • New Topic