<%@ page contentType="text/html; charset=UTF-8" %> Prelude and Coda Example - Gumdrop JSP

Prelude and Coda Example

← Back to JSP Examples

What you're seeing: This JSP page demonstrates automatic inclusion of content via JSP property group configuration. Notice the header section above (prelude) and footer section below (coda) that were automatically added by Gumdrop's JSP processing.

How Prelude and Coda Work

This page is configured in web.xml with JSP property groups that specify:

Web.xml Configuration

<jsp-property-group>
    <url-pattern>/jsp/enhanced/*</url-pattern>
    <include-prelude>/WEB-INF/includes/header-prelude.jsp</include-prelude>
    <include-coda>/WEB-INF/includes/footer-coda.jsp</include-coda>
</jsp-property-group>

Main Page Content

This is the actual content of the JSP file. The header and footer you see are automatically included by Gumdrop's JSP implementation based on the configuration in web.xml.

The prelude (header-prelude.jsp) includes:

The coda (footer-coda.jsp) includes:

Accessing Prelude Variables

Variables and methods declared in the prelude are available in this page:

Processing Order

When Gumdrop processes this JSP, the following happens:

  1. JSP property groups are resolved based on the URL pattern
  2. Include preludes are identified and processed first
  3. The main JSP content is processed
  4. Include codas are processed last
  5. All content is combined into a single servlet
  6. The servlet is compiled and executed

Benefits

Implementation Note: Gumdrop's JSPPropertyGroupResolver handles multiple property groups with cumulative prelude/coda lists, applying them in the order they appear in web.xml.

Sample JSP Source

The actual source of this JSP file contains only the main content. The prelude and coda are automatically added during processing:

<%@ page contentType="text/html; charset=UTF-8" %>
<!DOCTYPE html>
<html>
<head>
    <title>Prelude and Coda Example - Gumdrop JSP</title>
    <!-- ... rest of page content ... -->
</head>
<body>
    <!-- Main page content only -->
    <h1>Prelude and Coda Example</h1>
    <!-- No explicit includes needed! -->
</body>
</html>