1. Path starting with / -> Absolute path where / represents the document root of your application.
Firstly, Path starting with '/' is not absolute path, its relative path. Absolute path include the server name/ip and port etc like
http://www.me.com:8080/MyApp. Secondly, yes '/' represents the document root of you web application.
2. Path starting with ../ -> Relative path, i.e. relative to the current request.
Yes, this is also relative path, '..' denotes one directory up to the current directory
Ques 1. W.r.t 1., will '/' always refer to the document root of our web application? Will our-web-application always be the document root?
Yes '/' will always refer to document root i guess, please correct me if i am wrong
when we say /servlet/LoginServlet then we expect LoginServlet to be present under /Web-INF/classes/servlet.
No, it is not required to place it under /WEB-INF/classes/servlet, you can place it under any package in classes folder.
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 ?
Servlet's case is somewhat different, you need to specify a URL Mapping for a servlet to access it, and also provide the fully qualified class name to access it, it doesn't require you to put servlet in any specific package. Document root is still the same '/'
By the statement
req.getRequestDispatcher("../login.html");
what is the current directory so that we can know login.html should be one level up?
if you request came as
http://someserver:8080/YouApp/admin/pages/index.jsp then it will find login.html in admin directory i.e. one directory up to the current directory of requested page.