• Post Reply Bookmark Topic Watch Topic
  • New Topic

building paths ..\\

 
J Haley
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I see some working code in our production applications that locates included files with

file="..\\somefile.jsp"

I did not think that you could use ..\\

somefile.jsp is in the parent directory of the files that's calling it. This does work for us, but is it correct? We are running websphere 5.1 in windows. Are we getting away with this since we are running in windows?

Jay
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65516
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess by definition it is "correct" in that it works. Whether it's a good practice or not is another question.

Personally, I never use this type of notation as it introduces artificial coupling between files as the files depend upon each other's location in order to be "correct". Certainly poor from an architectural viewpoint.

From a practical viewpoint, it introduces fragility into your web app. Move one file, break a bunch of others. Not fun.

I always use server or context relative references (whichever is appropriate for the usage at hand) which introduce no artifical dependencies, and no fragility.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65516
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh, and the use of back-slashes rather than forward slashes is a bad idea too. Limits you to Windows systems only. JSP (and Java in general) will let you use the forward slash notation even on Windows systems, so it's a better notation to use.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!