File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Hyperlinks to the same page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Hyperlinks to the same page " Watch "Hyperlinks to the same page " New topic

Hyperlinks to the same page

Adam Rose

Joined: Jul 04, 2002
Posts: 5
Hi there, could someone please help me with this, I'm tearing my hair out!
I'm trying to link to another part of a JSP page using the normal HTML method, ie
<a href="#test">jump to test</a>
<a name="test">jumped</a>
But as the page is produced by a servlet and a JSP, the link is pointing to http://..../ServletName#test, which is reloading the whole page and making it really slow. Does anyone know how to make it stay on the same page? Maybe using JavaScript?
Thanks for your help, Adam
chanoch wiggers
Ranch Hand

Joined: May 24, 2001
Posts: 245
finally remembered how to do this. You need to set the following meta tag in the header of your page:
<base href="http://localhost:8100/yourapp/locationofyourjsp">
that will resolve the links correctly

chanoch<p><a href="" target="_blank" rel="nofollow">Author of Professional Apache Tomcat</a></p>
I agree. Here's the link:
subject: Hyperlinks to the same page
It's not a secret anymore!