You need to define if you are passing to a JSP page, or an Applet.
Some information on passing variables via applet:
- http://www.rgagnon.com/javadetails/java-0183.html
- http://www.daniweb.com/forums/thread93030.html
Apparently it's not possible to go Javascript to Java, unless you use querystring/cookies, things like that. Same applies with JSP pages, because there is a distinction between client side and server side, you will need to design your application so it utilises cookies/querystring/form values to achieve this.