*
The moose likes Tomcat and the fly likes tomcat4.1 : relative and absolute paths Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "tomcat4.1 : relative and absolute paths" Watch "tomcat4.1 : relative and absolute paths" New topic
Author

tomcat4.1 : relative and absolute paths

R K Singh
Ranch Hand

Joined: Oct 15, 2001
Posts: 5371
I am currently working on tomcat4.1.
And it looks like that there is no difference in Absolute and relative path.
It does not matter whether I am using href="myPage01.html" or href="/myPage01.html".
Both points to "myContext/myPage01.html".
Though the calling/source page[where this link is available] is in myContext/dir01/dir02/callingPage.html.


"Thanks to Indian media who has over the period of time swiped out intellectual taste from mass Indian population." - Chetan Parekh
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60775
    
  65

Relative URL's are interpreted by the browser (not Tomcat or whatever other servlet container you are using) and will be relative to the current URL and not to the file system location where the page is located (which the browser hasn't got a clue about).
So what's the URL of the page in which you have the "misbehaving" links?
bear


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
R K Singh
Ranch Hand

Joined: Oct 15, 2001
Posts: 5371
Originally posted by Bear Bibeault:
Relative URL's are interpreted by the browser (not Tomcat or whatever other servlet container you are using) and will be relative to the current URL and not to the file system location where the page is located (which the browser hasn't got a clue about).
So what's the URL of the page in which you have the "misbehaving" links?
bear

Looks like you are correct.
But then how come if you use URL like href="/somePage.jsp" is refered to <a href="http://myserver.com/<b rel="nofollow">myContext</b>/somePage.jsp" target="_blank">http://myserver.com/myContext/somePage.jsp
Before servlets 2.3, if you are refering like href="/somePage.jsp" then it will refer to http://myserver.com/somePage
Thanks in advance
R K Singh
Ranch Hand

Joined: Oct 15, 2001
Posts: 5371
I think, as my jsp are inside WEB-INF directory that why this problem is coming.
The jsp which are outside WEB-INF are working fine.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: tomcat4.1 : relative and absolute paths
 
Similar Threads
Properties file
request.getRequestURL() does not return URL in browser navigaiton bar
Absolute, Canonical, and relative path
I can't make it work !
Web.xml Question - Map Servlet