Get context Path Using JSTL

Get context Path Using JSTL explains about how to get context path inside a JSP page
pageContext is an implicit object available in JSP, so it is very easy to get the contextPath using JSTL EL Expression
You can access the request scoped varaibles in following different ways
Below code is equivalent to <%=request.getContextPath()%> in JSTL?
<c:out value="${pageContext.request.contextPath}"/>
you can see the below a complete example about accessing contextpath in JSTL
Required Libraries
Get context Path Using JSTL
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <html> <body> <!-- Get context path using JSTL --> <c:out value="${pageContext.servletContext.contextPath}" /> </body> </html>
Output
/JSTLExample