facebook

Image maps: passing info

  1. MyEclipse IDE
  2.  > 
  3. Off Topic
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #225356 Reply

    kieranocall
    Member

    Hi, Im new to this forum and looking for some help. I’ve created an Image map and I have differens areas linking to one JSP page. What i need to do is pass a string(or an int) to the linked JSP telling it which area of the Image map was pressed. This allows me to generate a different JSP depending on what part of the map is pressed. I know its possible to create a similar JSP for each area of the map, but I have over 70, so its not really an option.
    Im not sure if this is the best solution, I haven’t found any tutorials that explain this method, so i presume its not widely used. If there’s an easier way to do this I’d appreciate the help.
    Thank in addvance

    #225361 Reply

    Riyad Kalla
    Member

    Moving to OT > Soft dev, this is not ME related.

    As far as solution to your problem, you can make each segment of the map point to the same page with a different query string:
    segment #1: http://mysite.com/imageMap.jsp?clickedSegment=1
    segment #2: http://mysite.com/imageMap.jsp?clickedSegment=2
    segment #3: http://mysite.com/imageMap.jsp?clickedSegment=3
    and so on…

    Then in your JSP put the logic to get the “clickedSegment” parameter from the request, and look at it’s value then determine based on the segment #, which page should be generated.

    #225415 Reply

    kieranocall
    Member

    Riyad, thanks for your post. That looks like the solution im looking for. Ive added the request to my links and its now linking to the correct JSP with the querie attached to the URL.
    However I’m not sure how to extract the URL from the Bean, this maybe simple but I’m new to JSP also(complete beginner) and I cant seem to figure it out. Thanks for your help so far.
    Kieran

    #225420 Reply

    Riyad Kalla
    Member

    However I’m not sure how to extract the URL from the Bean

    I’m not sure if you really mean a “bean” here or if you are maybe using a term incorrectly… if you do mean bean, what bean are you referring do? How did you define it? How do you use it?

    As far as getting the value from the URL, you can do it with a scriplet like this:

    
    The clicked segment was: <%= request.getParameter("clickedSegment") %>
    

    or with JSTL like this (IIRC):

    
    The clicked segment was: <c:out value="${pageContext.request.param.clickedSegment}" />
    
Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: Image maps: passing info

You must be logged in to post in the forum log in