I know there is already questions about that, but I just can´t simply get this work, I have a JSP file with a java variable in it:
String test = "Hello";
And I need to read this value in the Javascript embedded in the same JSP file, I tried so many options, but it is not working, and for security I don't want pass the value using the URL or hidden values.
Any ideas of how get this working? Thanks :)
----UPDATE----
I changed my mind, I can use hidden fields to pass the value, now what I have is a hidden field called Id and I set its value:
value="<%=request.getAttribute("Id")%>"
And in Javascript I try to receive the value:
var Id = document.getElementById("Id").value;
But it is still not working :(