Here's an example that illustrates using the value of a variable defined in a JSP page as the value of a hidden field of an HTML form and passing the value of a variable defined in a jsp page to a javascript function:
After launching the above jsp page, if clicking on "open window" a new browser window that points to
http://www.javaranch.com should open. If you view the source of the page,
you should see that the value of the hidden variable of the html form is equal to "hidden".
NOTE: For some reason I couldn't get the post to submit when typing "onclick", so I spelled it "onclik".