In your code you are just creating a variable for your JSP.
You will have access to it by creating a element in your answer. something like:
<div id="var">value</div> <---JSP have to reply that.
<div id="var"><%= var.value() %></div> <--- exemple of JSP code to produce the answer u need.
And then you can use jquery $("#var") <--- that runs in the browser.
You will have to use CSS to hide it if you want.
or you can use Ajax, as an option.
Ajax:
$.ajax({
type: 'GET',
url: 'xxxx', <-- your url
success: function(reply) {
Alert(reply); <-- just for you to see the reply, u can do whatever..
}
});
$(reply), could help to parse or access stuff.
but to use this option, ur URL needs to point to a resource that is able to reply something like:
<div id="var">value</div> <---JSP have to reply that.
Resource example:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<% SomeVariableClass var = SomeVariableClass.getInstance()%>
<div id="var"><%=var.getValue()%></div>
</body>
cheers