Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes JSP and the fly likes Javascript function trying to access Scriptlet value Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Javascript function trying to access Scriptlet value" Watch "Javascript function trying to access Scriptlet value" New topic
Author

Javascript function trying to access Scriptlet value

Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Hi, As far as i know inside a JSP page Java is executed first and then Javascriptcode .

But this code is not executing as the variable 'a' inside the javascript function is not finding its value .please indicate what might be the error .





Thanks for reading .


Save India From Corruption - Anna Hazare.
Soumyajit Hazra
Ranch Hand

Joined: Jun 26, 2007
Posts: 136
change the callMe() function to
This is working for me. Have a try.

Java Programmer | SCJP 1.5 | SCWCD 1.4
Prasad Krishnegowda
Ranch Hand

Joined: Apr 25, 2010
Posts: 507

Ravi Kiran V wrote:





In the above function, browser thinks 'a' is a javascript variable, but its not, so use alert("Inside the Body Onload"+<%=a%>);
it should work..


Regards, Prasad
SCJP 5 (93%)
Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Thanks Soumyajit and Prasad , its working .
 
 
subject: Javascript function trying to access Scriptlet value
 
Similar Threads
How to pass input values to the JSP using POST method
JSP in Javascript
use body onload refresh functionality only once
running servlet after the browser is closed
How to pass input values to the JSP using POST method