How can I access JSP variables from a JavaScript function in a JSP page?
3 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Sri_Harsha
Posted On:   Friday, April 6, 2001 05:08 AM

How can I access JSP variables from a JavaScript function in a JSP page?

Re: How can I access jsp variables from a JavaScript function in a Jsp page?

Posted By:   shreya_rao  
Posted On:   Sunday, April 15, 2001 11:55 PM

Hi harsha,

Did you try passing the jsp variable in the javascript function. That way you get the value of the jsp variable in the script function.

ex.


<% String s = "hello" %>

Re: How can I access jsp variables from a JavaScript function in a Jsp page?

Posted By:   Chilang_Shen  
Posted On:   Sunday, April 8, 2001 06:22 AM

Perhaps there is some way to do this.

1. If you only want to use the variable value once , you can embed the jsp tag inside your JavaScript segment such as:





2. You can see the Resin project (www.caucho.com), which use JavaScript as a server side Script, but you can't use client side JavaScript access jsp variable directly!

Good luck my friends!!!

Re: How can I access jsp variables from a JavaScript function in a Jsp page?

Posted By:   John_Zukowski  
Posted On:   Friday, April 6, 2001 06:04 AM

Essentially, you can't. The JSP variable doesn't exist when the JavaScript is running as JSP runs in the server and JavaScript runs in the browser. Some servers though support server-side JavaScript. Read the FAQ for pointers on those.
About | Sitemap | Contact