I had the idea a while back to put all of my taglib declarations (uri\'s, etc) in a common header file so I don\'t have to manually write them into all of my JSPs. Initially, t
This is expected behaviour.
When you use <jsp:include>
, it executed the target in a separate request, and then includes the output in the including JSP. It doesn't include the source of the included target, it includes the output. The means by which that target output is generated is lost.
To do what you're trying to do, you need to use <% include %>
directives:
<%@ include file="/WEB-INF/jsp/include/header.jsp" %>
This will incline the literal text of header.jsp
into your page. Of course, by doing that, you can no longer pass parameters to it, so you'd need to set that as a page context attribute (e.g. using <c:set>
... but of course you can't use <c:set>
until you've done your include...).
Essentially, it's not really worth the hassle. Taglib declarations are annoying boilerplate, but hard to get rid of.