Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JavaScript var inside JSP Scriptlets  RSS feed

 
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: 65824
134
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 ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!