OK, let's say that you had a scoped variable named
whatever that is a
String with a value of "Hi there!" that you needed to access in JavaScript. As has already been pointed out, you can't access that
Java value once the response is sent to the browser, so you need to create a JavaScript equivalent:
This results in the following being sent to the browser:
With more complex constructs, such as an array or List, you'd use a combination of the JSTL and EL to create a corresponding JavaScript array. For example you'd need to figure out how to use JSTL and EL on a List to end up with markup similar to the following:
I will not write that code for you; you'll need to take a stab at it and post back with any issues you are running into.