Can I use a Javascript variable in the Java code of a JSP page?

Alessandro A. Garbagnati

No, you can't. The Java code inside a JSP page is executed on the server side, before the page is sent to the client, while the JavaScript code is executed on the client. When the page reaches the client, the Java code is not present on the page anymore.