Im looking for a way to get the x,y coords of where I clicked in my WebApp using Java EE only. But this seems to be impossible(correct me if I
m wrong).
So I`ve tried to use JS to pass the variables. I know I can use either forms or ajax, but those seem to be limited to one direction, so that I can only send values from Java--->JSP and not the other way around. It seems I can only send strings from JSP--->Java.
Is there a way to - instead of the alert - send thos values directly to a servlet, in the following fiddle?
$(document).ready(function(e)
{
$('#A').click(function(e) {
alert(e.pageX+ ' , ' + e.pageY);
});
});
#A
{
width:100px;
height:100px;
cursor:pointer;
background:#2f2f2f;
position:absolute;
top:50px;
color:#fff;
font:bold 15px Arial;
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html>
<head>
<title> Mouse Positions !! </title>
</head>
<body>
<div id="A" style="left:100px;"> Default
<br /> mouse <br/> position
</div>
</body>
</html>