Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JavaScript var inside JSP Scriptlets

 
Chua Keng Guan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<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
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JSP is server side script, so you won't access Javascript variables. Try to figure out another way to get the needed data.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65537
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Of course, I found a very beautiful couch. Definitely. And this tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!