20.5. Including Files and Applets in JSP Documents

JSP has three main capabilities for including external pieces into a JSP document.

  1. The include directive. The construct lets you insert JSP code into the main page before that main page is translated into a servlet. The included code can contain JSP constructs such as field definitions and content-type settings that affect the main page as a whole. This capability is discussed in the first following subsection.

  2. The jsp:include action. Although reusing chunks of JSP code is a powerful capability, most times you would rather sacrifice a small amount of power for the convenience of being able to change the included documents without updating the main JSP page. The jsp:include action lets you include ...

Get Core Web Programming, Second 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.