I'm using Apache Tomcat 6.0.26 with java servlets and JSPs.
Whe开发者_如何学运维never I'm trying to link to an external website, my anchor tags always contain my request context path before the external link. For example if my context path is http://localhost:8084/MyWebPage/ and I'm trying to link to www.google.com via this tag:
<a href="www.google.com">Google</a>
My anchor tag tries to go to http://localhost:8084/MyWebPage/www.google.com instead of www.google.com.
What am I missing here?
Thanks in advance.
You're missing the scheme. Add it:
<a href="http://www.google.com">Google</a>
It makes the link absolute. Right now you've a relative link which is relative to the current request URL and its behaviour is as per the specification.
精彩评论