You have to be clear on where each variable 'exists' in a client-server app.
The Java variable you want exists ONLY on the server.
You use all the state information you have to generate a HTML response that gets sent to the client.
When it is on the server this response it treated as text.
This text contains the Javascript, but it is treated as text at the server, not code.
The response gets sent to the client, the client browser loads up the web page and is now able to treat the javascript as code.
Not that the client now has NO KNOWLEDGE of the Java variables.
Sorry if this is a bit long winded, but I remember it took a bit of a leap when I was first trying to understand the whole 'client-server' thing.
So the problem you have tpo overcome is "How do you get the variable on the server to get passed to the client".
If we go back to the fact that the server sends text to the client, and it's this text that the client interprets as code, you just have to include the variable as text in the response sent to the client...
in SERVER_SIDE.jsp you have:
the 'text' that gets sent to the client that the client interprets as a web page would look something like this:
the server replaces the <%=location%> with its actual value before sending it to the client.
Hope this answers you question.
Dave.