4

can anyone explain what will this pageContext.request.contextPath does?it would be helpful if you give an example.Thanks in advance.

user3931813
  • 41
  • 1
  • 1
  • 3

1 Answers1

8

${pageContext.request.contextPath} is an EL expression equivalent to the JSP expression <%= request.getContextPath() %>.

It is recommended to use ${pageContext.request.contextPath} instead of hard-coding your context path.

E.g. <a href="${pageContext.request.contextPath}/info/page.html">Link</a> is better than <a href="http://abc.xyz.com/info/page.html">Link</a>