A.12. Including Files and Applets in JSP Documents

Including Files at Page Translation Time

  • <%@ include file="Relative URL" %>

  • Changing included file does not necessarily cause retranslation of JSP document. You have to manually change JSP document or update its modification date. Convenient way:

    <%-- Navbar.jsp modified 3/1/00 --%>
    <%@ include file="Navbar.jsp" %>
    

Including Files at Request Time

  • <jsp:include page="Relative URL" flush="true" />

  • Servlets can use include method of RequestDispatcher to accomplish similar result. See Section 15.3.

  • Because of a bug, you must use .html or .htm extensions for included files used with the Java Web Server.

Applets for the Java Plug-In: Simple Case

  • Regular form:

     <APPLET CODE="MyApplet.class" WIDTH=475 HEIGHT=350> ...

Get Core Servlets and JavaServer Pages™ 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.