I want to access Javascript variables in JSP code. How can I do that?
JavaScript variable is on client side, JSP variables is on server side, so you can't access javascript variables in JSP. But you can store needed data in hidden fields, set its value in client and get it on server over GET or POST.
Client side:
server side:
<%
if (request.getParameter("data") != null) { %>
Your value: <%=request.getParameter("data")%>
<%
}
%>