I know this is a no-javascript forum, but this really is more of a JSP/servlet question. If I pass the following variable via a servlet: request.setAttribute(“myString”, “HELLO”);
I can access the variable with the affected JSP by: <%= (String) request.getAttribute(“myString”) %>
My Problem is this:
I have a very simple javascript embedded in the affected JSP as follows:
function runthis() {
var test = <%= (String) request.getAttribute(“myString”) %>;
alert(test);
}
This does NOT work when I call that function. Can I not access a servlet variable via javascript?