• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

how can i get a value in java script function from database  RSS feed

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hii
is their any way to get some value from database to java script function?
i want to access a database value from database to java script function through jsp. but after so many effort i am unable to pass that value.
if u have any suggesions regarding to this problem then please send it.
actually i am execute a sql query in jsp for retrive data from database.but i can't able to send this value to my java script function for validations of that value.
if anyone have the solution then please send the solution of that problum with some sample code.
thankx in advance
i am waiting for replies
:abhishek paliwal
 
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't 'pass' a value to a Javascript function from JSP because the two are running in different environments.

You use JSP to 'write' your javascript.
While doing so, you can write the value of your JSP variables as Javascript literals.



When you view the HTML source from the browser, you will JSP properties's value written to the source.
[ June 28, 2005: Message edited by: Ben Souther ]
 
Ranch Hand
Posts: 256
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can pass the values in the call to the javascript function
as


Use the above code for your purpose to full effect.

[ June 28, 2005: Message edited by: Niki Nono ]
[ June 28, 2005: Message edited by: Niki Nono ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the misleading term here is "pass".
You never actually pass a value from one realm to the other.

The JSP code writes the Javascript code.
As far as the browser is concerned, there is no difference between a string literal, typed by hand, into a flat file and the result from a JSP expression tag.

It's all just text to the browser.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!