This week's book giveaway is in the Testing forum.
We're giving away four copies of Practical Unit Testing with TestNG and Mockito and have Tomek Kaczanowski on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes Any information about ImageMap ? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Practical Unit Testing with TestNG and Mockito this week in the Testing forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "Any information about ImageMap ?" Watch "Any information about ImageMap ?" New topic
Author

Any information about ImageMap ?

Steve Mutanson
Ranch Hand

Joined: Apr 15, 2003
Posts: 67
I would like to use JSP to display a railway .gif image in the center of output page, and when user clicks one particular section of this railway zone, it calls servlet again and return with another .gif for that railway section. Also when user move mouse on a particular zone it shows him the rail station name for that zone section by poping up a small box next to the mouse. I saw some METRO site has such cool stuff but not sure how they implement it.
I thought it must use ImageMap to do it, but I don't know much about it. Do I need to use ImageMap to do it ? Is there any tutorial for ImageMap ? And principally how to implement the above functions ?
any input will be appreciated.
Bear Bibeault
Author and opinionated walrus
Marshal

Joined: Jan 10, 2002
Posts: 50674

What you are trying to do is a very straight-forward use of image maps. What specifically is stumping you?
Here is some info on the <map> tag and the area tag to help get you started.
hth,
bear


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Steve Mutanson
Ranch Hand

Joined: Apr 15, 2003
Posts: 67
Originally posted by Bear Bibeault:
What you are trying to do is a very straight-forward use of image maps. What specifically is stumping you?
Here is some info on the <map> tag and the area tag to help get you started.
hth,
bear

Bear,
Thanks for response. What bothers me is --- This is a servlet/JSP application. So the client-side has no control over the image. The image is generated on the server and returned to client as a JPEG file. So, on the client side I just do
<img src="my.JPEG" href="">. If this map is a client-side map, i.e. if client knows the geometry and coordinates of the image then it can do what you said. In this case when img is created in server, how do we handle it since client doesn't know coordinates ? I've heard there is something called server-side image map, how does that work ? Does client needs to know the coordinates of each zone ?
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15003
Does the server side know the variables?
Steve Mutanson
Ranch Hand

Joined: Apr 15, 2003
Posts: 67
Originally posted by Eric Pascarello:
Does the server side know the variables?

Not exactly sure what you mean. Of course, the server can get the variables if client passes to it. for example, if user clicks on a zone of the image I can call a servlet by passing particular parameters for that "zone" to the servlet, but the issue here is --- If client has no knowledge about the image shape and components (client just gets a .JPEG for the whole image), How do client "associate" a portion of the graph with certain coordinates and do the redirect ? Does server need to do something differently instead of returning a simple .JPEG file ?
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15003
What I am talking about is it is possible to tell where the image is clicked with JavaScript. You can code dynamic ranges for each section, but it would have to get the variables from something.
When the new image is generated can you generate the variables??
Eric
Bear Bibeault
Author and opinionated walrus
Marshal

Joined: Jan 10, 2002
Posts: 50674

The image is generated on the server and returned to client as a JPEG file.

Intriguing. So what you are saying is that you don't have a bunch of pre-defined images that you can create image maps from using known regions of the image?
Can you give us more info in how the image is generated? From info in a database? Some other data?
bear
Steve Mutanson
Ranch Hand

Joined: Apr 15, 2003
Posts: 67
OK, the scenario is like this: in my front end, I can ask user pick what departure, destination stations, etc. Then user clicks "Get tour map" button and it invokes a servlet, this servlet takes the above parameters and use some Java 2D or whatever API to create a tour map image in the format of .JPEG file, and return this .JPEG file back to the font end page. SO client will see this image. Now the client wants to be able to zone-in/out on this image by clicking on a portion of the tour and it should amptify or minimize the tour map. Suppose you click a portion on the tour to narrow it down "from NY to DC", then it send the servlet that depart=NY, arrival=DC and it returns a local tour map covering NY to DC. It will be another .JPEG file.

That's why I said client has no idea about the image's coordinates. How does this work ? I believe there should be some sort of coordination between server and client, right ? I heard something about "server-side image map" but don't know too mcuh about it, and don't know if it can apply to here and how to.
Bear Bibeault
Author and opinionated walrus
Marshal

Joined: Jan 10, 2002
Posts: 50674

Whether the coords are processed on the client or server side is actually rather immaterial since anything you know about on the server can be exposed to the client via JSP.
What is important is that the cords are known to begin with.
So if you know the coords of the "hot regions" on the image, I'd generate a client-side image map using that information on the page in which the image will be displayed. Should be fairly straight-forward using JSP technology.
hth,
bear
 
 
subject: Any information about ImageMap ?
 
Threads others viewed
print database values with radio button
Any information about ImageMap ?
to forum bartner/sheriff
Help providing visual confirmation
Events/task list in web application

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture