• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Absolute Path Vs Relative Path

 
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1. Path starting with / -> Absolute path where / represents the document root of your application.

2. Path starting with ../ -> Relative path, i.e. relative to the current request.

Ques 1. W.r.t 1., Will our-web-application always be the document root?

Ques 2. w.r.t 1. Consider our-web-application is the document root. If we want to access a html file, then by /login.html, we expect login.html to be present under <our-web-application> (i.e / represents <doc root> BUT when we say /servlet/LoginServlet then we expect LoginServlet to be present under /Web-INF/classes/servlet. Why in this case the <doc root> is changed (surely it is not our-web-application as / represents classes)? Moreover what is / represents in this case ?

Ques 3:
By the statement
req.getRequestDispatcher("../login.html");

what is ../ representing to?
 
I was born with webbed fish toes. This tiny ad is my only friend:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic