Rectangle 27 1

how to pass javascript variable to the jstl code?


jstl is executed in server side so you can't pass a javascript variable to jstl. What you can do is generate dynamic javascript using jstl.

Note
Rectangle 27 0

how to pass javascript variable to the jstl code?


First, you need the following concept right: Java/JSP runs at the server machine and produces a HTML/CSS/JS page. The server machine sends HTML/CSS/JS page over network (HTTP) to the client machine. Client machine retrieves HTML/CSS/JS and starts to interpret HTML to display a markup structure, apply CSS to style and position the structure and execute JS on the resulting the HTML/CSS.

More background information and code examples can be found in this article.

There is no means of any line of Java/JSP code at the client machine. Rightclick page and view source. The only way to pass Java/JSP variables to Javascript is to just output them as if it's a Javascript variable so that it has instant access to it once it runs at the client machine. The only way to pass Javascript variables to Java/JSP is to just send a HTTP request with that variable as parameter and have Java/JSP to listen on that specific request.

Note