• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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?
 
Evildoers! Eat my justice! And this tiny ad's justice too!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic