When using the include directive, you shouldn't need to use getContextPath
Originally posted by Bear Bibeault:
Correct. Since includes happen on the server side, the container knows which context the file belongs to, so such references are relative to the container root.
This is not the same as images and style sheets which are referenced by the browser on the client side where the context path must be specified.
<%@ include file="<%=request.getContextPath()%>includes/header.jsp" %>