Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Absolute Path Vs Relative Path

 
Sandeep Vaid
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
  • 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?
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic