You cannot mix
JSP code with JavaScript. Please read
this article to understand how JSP operates and why this is impossible.
If you want to communicate with the server via JavaScript, you'll need to use Ajax.
So, what is it that you are actually trying to accomplish?