• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

tomcat4.1 : relative and absolute paths

 
R K Singh
Ranch Hand
Posts: 5384
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64964
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
R K Singh
Ranch Hand
Posts: 5384
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5384
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic