• 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
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

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

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
You totally ruined the moon. You're gonna hafta pay for that you know. This tiny ad agrees:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic