Metawerx Java Hosting Small Logo

<url-pattern>

This tag specifies a single URL pattern for a <servlet-mapping>, <web-resource-collection> or <filter-mapping> element.

In <servlet-mapping>, this tag defines the URL patterns which will trigger the servlet.

In <web-resource-collection>, this tag defines the URL patterns which will be protected by the security constraint.

In <filter-mapping>, this tag defines the URL patterns which will trigger the filter.

In <jsp-property-group>, this tag defines the URL patterns for JSP files which will trigger the other properties that have been set (eg: headers, footers, page encodings).

The tag is somewhat restrictive, because only a few pattern types are possible. However, for servlet mappings, more complex patterns can be set up by mapping all requests to another servlet which provides better parsing.

Examples:

  • *.do - a file extension pattern, matching any URL that ends in .do, eg: Struts uses this to map action.do to its action servlet.
  • /content/* - a path pattern, matching any URL that begins with /content/, eg: /content/Product/41
  • /MyServlet - a specific pattern, matching only the URL /MyServlet
  • /servlet/MyServlet - another specific pattern, matching /servlet/MyServlet
navigation
metawerx specific
search
Share
tools
help

referring pages

Share