1. Document Root:
It is your web application directory when deployed in web container (eq Tomcat or Websphere Application Server)
Not exactly. It is the top-level directory in your web application structure. It is more of a development time term. It is not a deployment time term.
Example: Your structure during development is SV_Web_Application with Temp folder as a sub folder and other files in it, then SV_Web_Application is the document root.
By the way, in Websphere you cannot deploy applications without creating a WAR or EAR file. Tomcat/WebLogic will allow you to deploy an application without the need to create an archive.
2. Context Root:
Is It Other name of Document Root OR is it folder above classes folder?
It is not the folder above classes folder. Classes folder resides inside WEB-INF folder, which in turn resides inside your document root.
Context root is a deployment time term.
After you are done with your coding, you deploy the application. You can either have the folder SV_Web_Application copied under webapps in Tomcat or deploy a war file you created with the contents inside SV_Web_Application.
By default, tomcat uses the name of the document root as the context name if you copy the entire document root folder along with its contents under webapps. But during deployment of a web module, we can specify the context name for the web module. This can be different from the document root name.
3. Absolute Path:
The path with starts with / (/ being the document root)
The path starts with Context Root. Of course, sometimes document root and context name are the same.
4. Relative Path:
When we say request.getRequestDispatcher("../html/copyright.html"), what this path is relative to.
Relative path is relative to current request. Say you are coding in a file inside <root>/pages/HelloWorld.jsp. Here, if you have a relative path ../html, it will navigate to root and then get inside html folder while serving the request.
[ March 11, 2007: Message edited by: Sunil Vasudevan ]