aspose file tools*
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 Spring in Action this week in the Spring 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: 537

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..
Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Thanks Soumyajit and Prasad , its working .
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Javascript function trying to access Scriptlet value