- This topic has 3 replies, 2 voices, and was last updated 19 years, 10 months ago by Riyad Kalla.
-
AuthorPosts
-
kieranocallMemberHi, 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
Riyad KallaMemberMoving 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.
kieranocallMemberRiyad, 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
Riyad KallaMemberHowever 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}" />
-
AuthorPosts