The include directive
The include directive tells the Container one thing: copy everything in the included file and paste it into this file, right here...
Standard header file (“Header.jsp”)
<html><body> <img src="images/Web-Services.jpg" > <br> <em><strong>We know how to make SOAP suck less.</strong></em> <br> </body></html>
Note
We want this HTML content on every page in our web app.
A JSP from the web app (“Contact.jsp”)
<html><body> <%@ include file="Header.jsp"%> <br> <em>We can help.</em> <br><br> Contact us at: ${initParam.mainEmail} </body></html>
Note
This says “Insert the complete Header.jsp file into this point in THIS page, then keep going with the rest of this JSP...”
Get Head First Servlets and JSP, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.