0

Software version:

Glassfish 4.1.x


In a JSP, when trying to access the context path, the following code works (for me):

${pageContext.request.contextPath}

However, when shorten to:

${request.contextPath}

then, either it does not evaluate and therefore evaluated to empty string; or it did work, and simply evaluated to an empty string.

Should not the request object be available, as specified by implicit objects in a JSP? If that it is available, then accessing the context path should work with the shortened version.

Please explain this discrepancy.

pntran84
  • 463
  • 1
  • 3
  • 11
  • 1
    See http://docs.oracle.com/javaee/1.4/tutorial/doc/JSPIntro7.html#wp71043: there is no such `request` implicit object. You seem to be confusing objects available to scriptlets, and objects available to the JSP EL. – JB Nizet Jan 28 '16 at 07:33
  • Yes thanks for clearing that up. Understood now. Though it is odd that scriptlet objects availability differs to JSP EL (I'm assuming that's the case here). – pntran84 Jan 29 '16 at 06:07

0 Answers0