Declaring a File as a JSP Page

If a request matches a URL pattern defined within any <jsp-property-group> element, it’s implicitly defined to be a JSP page, i.e., a file the JSP container must process. A potential use for this feature is to define additional extensions that should be treated as JSP pages:

<web-app ...>
  ...
  <jsp-config>
    <jsp-property-group>
      <url-pattern>*.html</url-pattern>
    </jsp-property-grop>
  </jsp-config>
  ...
</web-app>

A deployment descriptor like this tells the container to process all requests with an .html extension as JSP pages; this might be used to add a piece of dynamic content to a previously static web site without having to rename all files.

Get JavaServer Pages, 3rd 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.