The <jsp:include /> standard action and the include directive look the same, and often give the same result, but take a look at the generated servlets. We took this code directly out of the _jspService() method from Tomcat’s generated servlet code...
Generated servlet code for the header file
out.write(" <html> <body> <img src="images/Web-Services.jpg" > <br> <em><strong>We know how to make SOAP suck less.</strong></em> <br> </body> </html> ");
Generated servlet for the JSP using the include directive
out.write("<html><body> "); out.write(" <html> <body> <img src="images/Web-Services.jpg" > <br> <em><strong>We know how to make SOAP suck less.</strong></em> <br> </body> </html> "); out.write(" <br> <em>We can help.</em> <br><br> Contact us at: "); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl. proprietaryEvaluate("${initParam.mainEmail}", java.lang.String.class, (PageContext)_jspx_page_context, null, false)); out.write(" </body></html>");
The include directive just takes the contents of the “Header.jsp” file and places it into the “Contact.jsp” page BEFORE it does the translation!
Generated servlet for the JSP using the <jsp:include /> standard action
This is different! The original Header.jsp file is NOT inside the generated servlet. Instead, it’s some kind of runtime call...
out.write("<html><body> "); org.apache.jasper.runtime.JspRuntimeLibrary.include(request, response, "Header.jsp", out, false); out.write(" <br> <em>We can help.</em> <br><br> Contact us at: "); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl. proprietaryEvaluate("${initParam.mainEmail}", java.lang.String.class, (PageContext)_jspx_page_context, null, false)); out.write(" </body></html>");