Accessing the Context Path in a JSP Page

Login | Register

Accessing the Context Path in a JSP Page

JSP

Accessing the context path in a JSP page is simply a matter of querying the pageContext‘s request object.

<html>
  ...
  <img src="${pageContext.request.contextPath}/fullPath.png" />
  ...
</html>

About

At Develop In Java, we've been a part of the Java community for over 10 years. If there's anything you'd like us to cover, just ask !

Current versions

  • Java - 1.8
  • Java EE - 7
  • Spring - 4.x