Java/JSP runs at the server machine.
Java/JSP generates HTML/CSS/JS output.
Server machine sends HTML/CSS/JS output to the client machine.
Client machine retrieves HTML/CSS/JS and starts to interpret/run it.
View a JSP page in your webbrowser. All you see is HTML/CSS/JS. No scriptlets, no taglibs, no EL.
Whenever you want to run JS using Java/JSP, simply print it out. E.g. <script>var = '${foo}';</script>.
Whenever you want to run
Java using JS, simply invoke a request from the client to the server. You can use window.location, form.submit() or new XmlHttpRequest() for this.