Using jsp:include to include pages at request time
Using <%@ include ... %> (the include directive) to include files at page translation time
Understanding why jsp:include is usually better than the include directive
Using jsp:plugin to include applets for the Java Plug-in
JSP has three main capabilities for including external pieces into a JSP document:
The jsp:include action. The jsp:include action lets you include the output of a page at request time. Its main advantage is that it saves you from changing the main page when the included pages change. Its main disadvantage is that since it includes the output of the secondary page, not the secondary page's actual code as with the include directive, the included pages cannot use any JSP constructs that affect the main page as a whole. The advantages generally far outweigh the disadvantages, and you will almost certainly use it much more than the other inclusion mechanisms. Use of jsp:include is discussed in Section 13.1.
The include directive. This construct lets you insert JSP code into the main page before that main page is translated into a servlet. Its main advantage is that it is powerful: the included code can contain JSP constructs such as field definitions and content-type settings that affect the main page as a whole. Its main disadvantage is that it is hard to maintain: you have to update the main page whenever any of the included pages change. Use of the include directive is discussed in Section 13.2.
The jsp:plugin action. Although this book is primarily about server-side Java, client-side Java in the form of Web-embedded applets continues to play a role, especially within corporate intranets . The jsp:plugin element is used to insert applets that use the Java Plug-in into JSP pages. Its main advantage is that it saves you from writing long, tedious , and error-prone OBJECT and EMBED tags in your HTML. Its main disadvantage is that it applies to applets, and applets are relatively infrequently used. Use of jsp:plugin is discussed in Section 13.4.