This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan 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 Android Security Essentials Live Lessons this week in the Android 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>
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Hyperlinks to the same page
 
Similar Threads
how call doPost()
css link problem
Servlet not found using <jsp:include
Hyperlinks to the same page
Web Page calling JSP