Name

<mime-mapping>

Synopsis

The <mime-mapping> element can define the mappings an application requires.

Syntax

<mime-mapping>
  <extension>fileExtension</extension>
  <mime-type>mimeType</mime-type>
</mime-mapping>

A servlet may need to know which MIME type a file extension corresponds to, and such a mapping can be defined with this element:

<mime-mapping>
  <extension>wml</extension>
  <mime-type>text/vnd.wap.wml</mime-type>
</mime-mapping>

Most containers provide default mappings for the most commonly used extensions, such as .html, .htm, .gif, .jpg, and so on, but if you need to be absolutely sure that a mapping is defined for your application, put it in the web.xml file.

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.