can anyone explain what will this pageContext.request.contextPath does?it would be helpful if you give an example.Thanks in advance.
Asked
Active
Viewed 1.8k times
1 Answers
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>

Kamlakant Shukla
- 77
- 1