aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes JavaScript var inside JSP Scriptlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
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: 14687
    
  16

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: 60046
    
  65

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 ]

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