You can't. The Java code in your
JSP (very old-fashioned that, putting Java in a JSP) executes on the server long before the page gets to the browser where the JavaScript can be interpreted.
Please read
this article in order to understand the life cycle of a JSP.