The moose likes JSP and the fly likes Is it possible to pass a value from JSP to Javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Reply locked New topic

Is it possible to pass a value from JSP to Javascript

Ramesh Shanmugam
Ranch Hand

Joined: Sep 13, 2004
Posts: 132
I have a JSP page, in which i need to pass a Value of a Text box to a Javascript.
IS it possible to do so.

Ramesh Shanmugam - SCJP 1.5
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
You can write the value that's known during HTML generation to the Javascript using JSP code before the HTML is sent to the client.
You can use Javascript to read the actual value at the client at any time, read a Javascript book.

How often must we repeat: JSP is SERVERside code, Javascript is CLIENTside code. They can NOT interact during execution.

Anil Kumar Saha
Ranch Hand

Joined: Apr 07, 2004
Posts: 111
Here is an example


Anil Kumar Saha
SCJP 1.4
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15376
Please do not cross post: http://www.coderanch.com/t/115191/HTML-JavaScript/pass-value-JSP-Javascript-same

subject: Is it possible to pass a value from JSP to Javascript
Similar Threads
Javascript variable inside jsp scriplet
How to pass values between JSP - JSTL - Javascript ?
How to pass a value from a JSP to Javascript on the same page.
javascript passing value to JSP
passing value from javascript function to JSP