JavaScript executes on the client long after the JSP has executed. So there can be no interaction between them. You may find
this article helpful.
But remember that JavaScript is just template text to the JSP, so you can use the JSP to create the JavaScript.
So if you need the value in JSP variable x to be "passed" to a JavaScript function:
If the value of x is 213, this will result in the following on the HTML page: