aspose file tools*
The moose likes Servlets and the fly likes catch image x, y coordinate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "catch image x, y coordinate" Watch "catch image x, y coordinate" New topic
Author

catch image x, y coordinate

Ariffin Ahmad
Ranch Hand

Joined: Aug 16, 2001
Posts: 84
how can i get x and y coordinate on some image.
what i actually want to do is, whenever i click on some image, on a web page, my servlet or jsp on the web server will catch that coordinate and then, do something with it.
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459


if you put it in a FORM tag, the x and y coords that were clicked will be pased back as x and y
Dave
Ariffin Ahmad
Ranch Hand

Joined: Aug 16, 2001
Posts: 84
sorry about posting on two different forum..
i'm just fot sure where to put it....
anyway about the code:

what if, i don't know the image's width and height, can i still use it?...
and, how actually i get the coordinate from the servlet. can i use the normal request.getParamater(???)?... or, there is some way else?...
thanks....
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

It is better to include the image height and width if you know it since the browser can show the image more efficiently, but no, it isn't actually required.
To test how to get the data back, if you write a simple page like this:

Then see what gets passed to the servlet, you will find that the parameters are 'x' and 'y'.
Dave
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: catch image x, y coordinate