This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes JavaScript var inside JSP Scriptlets Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "JavaScript var inside JSP Scriptlets" Watch "JavaScript var inside JSP Scriptlets" New topic
Author

JavaScript var inside JSP Scriptlets

Chua Keng Guan
Greenhorn

Joined: Oct 11, 2006
Posts: 10
<script type="text/JavaScript">

var a = 1;
<% JavaFile.staticInt = a %>

</script>

The above example will cause a error stated that varible a is not found(no such symbol). Do anyone know how to solve this problem. Thanks
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14672
    
  11

JSP is server side script, so you won't access Javascript variables. Try to figure out another way to get the needed data.


[My Blog]
All roads lead to JavaRanch
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56201
    
  13

You have a fundamental misunderstanding of what JSP technology is all about.

Perhaps this article will be helpful.
[ October 17, 2006: Message edited by: Bear Bibeault ]

[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JavaScript var inside JSP Scriptlets
 
Similar Threads
Need help
How to pass struts 2 variable to a javascript method
Accessing javascript variable in jsp
How to use JSTL varraible in to jsp
frames problem