I made myself a template for all JSPs in my webapp that keeps things very simple:
<%@ include file="header.jsp" %>
<!-- Put unique content here -->
<%@ include file="footer.jsp" %>
<jsp:include page = "menu.jsp"/>
<%@ taglib prefix = "c" uri = "http://java.sun.com/jsp/jstl/core"%>
<%@ include file="menu.jsp" %>
<%@ include file="header.jsp" %> is self refrencing
A JSP page included dynamically (
<jsp:include />) must have a taglib declaration if it uses the taglib because it is compiled separately.
A JSP page included statically doesn't have the same restriction because it's compiled into the servlet itself.
What's the big deal about declaring a taglib in a JSP in which it's used? That makes it a standalone "chunk" of functionality, dynamically includable anywhere, self-documenting, without worrying about the page it's being included in: this is the goal of breaking up functionality.