There are a number of types of paths used in
Java web applications, each of which may be required or preferred in different situations:
absolute path, starts with the protocol and is an absolute locator for a resource. It is not relative to anything and identifies the protocol (scheme), domain, and resource path.
Examples:
protocol-relative path, starts with "//" and is relative to the current protocol (or scheme) so that an otherwise absolute URL can use the same scheme as the current path.
Example:
server-relative path, starts with the context path. Preferred for URLs initiated from the browser (e.g. images, script files, stylesheets, form actions, and so on).
Examples:
context-relative path, starts with "/" and is relative to the context base. Paths starting with "/WEB-INF" are a good example. Preferred for paths used on the server for resources within the same web app (includes, forwards, etc).
Examples:
page-relative path, relative to the current URL path. Anything that starts with "." or ".." or a file or folder name relative to the current path. These are fragile because they are relative to something that may change (current path) and should not be used in Java web applications anyplace that a server-relative or context-relative path can be used. An example of an exception is paths within stylesheets which cannot be easily prefixed programmatically with the context path.
Examples:
JspFaq ServletFaq