Different
types of Url-Patterns
According to Sun Microsystems, there are 3 types of
url-patterns which can be
assigned to servlet program.
1. Exact Match
2. Directory Match
3. Extension Match
2. Directory Match
3. Extension Match
Exact Match
The exact match url-pattern must begin with ― / ‖ symbol and
should not contain ― * ‖
symbol.
Ex: <url-pattern>/test1</url-pattern>
<url-pattern>/test1.xyz</url-pattern>
<url-pattern>/test1/test2</url-pattern>
<url-pattern>/test1/abc.do</url-pattern>
Directory Match
This url pattern must begin with ― / ‖ symbol and must end
with ― * ‖ symbol.
Ex: <url-pattern>/x/y/*</url-pattern>
<url-pattern>/x/*</url-pattern>
<url-pattern>/test1/test2/*</url-pattern>
<url-pattern>/test1/abc.do/*</url-pattern>
Extension Match
This url-pattern must begin with ― * ‖ symbol and must end
with extension letter or
extension word.
Ex: <url-pattern>*.abc</url-pattern>
<url-pattern>*.do</url-pattern>
<url-pattern>*.c</url-pattern>
Note
You cannot frame url-pattern for servlet program without
following those 3 styles of
above url-patterns.
Ex: <url-pattern>/x/y/*.do</url-pattern>
Invalid url-pattern formation