suppose the current servlet is deployed under the context root "/". What does HttpServletRequest.getContextPath(...) return?
My study guide says "", but I don't really understand why this isn't "/" ?
... the context path never ends with a /, and therfore "/" maps to "".
I just can't follow that statement.
That is just as it is defined in the API:
Returns the portion of the request URI that indicates the context of the request. The context path always comes first in a request URI. The path starts with a "/" character but does not end with a "/" character. For servlets in the default (root) context, this method returns "".