Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

catch image x, y coordinate

 
Ariffin Ahmad
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic