This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
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


Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Hyperlinks to the same page " Watch "Hyperlinks to the same page " New topic
Author

Hyperlinks to the same page

Adam Rose
Greenhorn

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
Author
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="http://www.amazon.com/exec/obidos/ASIN/1861007736/" target="_blank" rel="nofollow">Author of Professional Apache Tomcat</a></p>
 
Have you checked out Aspose?
 
subject: Hyperlinks to the same page
 
jQuery in Action, 3rd edition