<%@ include %>
directive
<jsp:include>
action
<jsp:forward>
action
When it runs once, at translation time (the first time the page is compiled) on every request on every request
Output of the calling page kept, with the fragment pasted into it kept, with the fragment's output merged in discarded — only the target's output is sent
Address bar unchanged unchanged unchanged (the browser is never told)
Can add parameters no yes, with <jsp:param> yes, with <jsp:param>
Variable names collide? yes — a local variable declared in both files is a duplicate-definition compile error no — the two pages are compiled separately no
Best for static HTML fragments: header, footer, menu dynamic fragments, servlets, templates the "entry page" pattern: index.jsp decides which real page to show, e.g. after a login

The full list of JSP action tags (slides 2-3)

ActionPurpose
jsp:forwardforward the request and response to another resource
jsp:includeinclude another resource
jsp:useBeancreate or locate a bean object
jsp:setPropertyset the value of a property in a bean object
jsp:getPropertyprint the value of a property of a bean
jsp:paramset a parameter for forward or include
jsp:pluginembed a component such as an applet — removed from the JSP specification, see below
jsp:fallbackprint a message if the plugin is not working — removed, see below
About the applet example (slides 31-33). The slides finish with <jsp:plugin type="applet" code="MouseDrag.class"/>. Both jsp:plugin and jsp:fallback were deprecated in JSP 2.0 and removed, Java applets have been removed from the JDK, and no modern browser supports them. The tag is no longer part of the specification, so it is deliberately not reproduced here — a page using it fails to compile on Tomcat 9.

Two other slide items are likewise concept only on a modern container and are documented in the README rather than built: the isThreadSafe attribute (Session 1, slide 21) and the manual copying of JSTL jars into Tomcat's directories (Session 5).

← Back to the example index