Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

I am not understanding the meaning of ../

 
Swapna latha
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<%@ include file="../view.jsp" %>

In this i am not understanding the meaning of ../

I am getting confusion with /, ./ , and ../.

Thanks in advance

swapna
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65220
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It'a a rather poor practice. It means up in the parent folder; which makes it a page-relative URL. Very fragile.

The URL should not be page relative -- it should start with a / that represents the context root.
 
Swapna latha
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:It'a a rather poor practice. It means up in the parent folder; which makes it a page-relative URL. Very fragile.

The URL should not be page relative -- it should start with a / that represents the context root.


Thanks bear for the prompt answer. But i am not clear. Can you elaborate please ?

Thank you in advance
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65220
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll have elaborate on what you are not clear on.
 
Mansukhdeep Thind
Ranch Hand
Posts: 1158
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Swapna wrote: <%@ include file="../view.jsp" %> In this i am not understanding the meaning of ../


When you write ../view.jsp you are instructing the current jsp to include a file by the name of view.jsp located in a directory that is one level up from the directory in which your current jsp is located.
 
Swapna latha
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mansukhdeep Thind wrote:
Swapna wrote: <%@ include file="../view.jsp" %> In this i am not understanding the meaning of ../


When you write ../view.jsp you are instructing the current jsp to include a file by the name of view.jsp located in a directory that is one level up from the directory in which your current jsp is located.


Thank you very much mansukhdeep. Now i got it

 
Mansukhdeep Thind
Ranch Hand
Posts: 1158
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are always welcome. :)
 
Swapna latha
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mansukhdeep Thind wrote:You are always welcome. :)


Hi mansukhdeep, whats the difference between ./ and / then ?

thanks in advance

swapna
 
Saif Asif
Ranch Hand
Posts: 440
Eclipse IDE Hibernate Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Greetings Swapna,

Well ./ ( dot slash ) means the current directory and / (slash) means the root directory of the context.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65220
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And, once again, page-relative URLs that employ ../ and ./ should never be used. It's just asking for trouble.
 
Swapna latha
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:And, once again, page-relative URLs that employ ../ and ./ should never be used. It's just asking for trouble.


Thank you very much saif and bear. Out of curiosity i would like you (bear) to ask that why it should not be used . Whats the trouble with page-relative URLs ?

Thanks in advance

swapna
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65220
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
They are fragile. Any changes outside the page could cause the page to stop working correctly, and it makes refactoring the structure of a web app much harder. Maybe not a problem when you only have one page, but as soon as a web app starts growing, those are the kind of problems that can become a huge headache.

Using server-relative addresses is much more robust.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic