Home  >  Article  >  Java  >  Detailed explanation of the use of url-pattern in JavaWeb Servlet

Detailed explanation of the use of url-pattern in JavaWeb Servlet

黄舟
黄舟Original
2017-10-11 09:41:401700browse

This article mainly introduces the relevant information about the use of url-pattern in JavaWeb Servlet. I hope this article can help everyone learn and understand this part of the content. Friends in need can refer to it

Usage of url-pattern in JavaWeb Servlet

1. Instructions related to url-pattern of Sevlet and Filter

A page request is based on url -pattern only matches the best Servlet, and according to the order of the filter-mapping tags in web.xml, one or more filters that meet the requirements will be generated into a FilterChain

2.url- pattern configuration

Configure the web.xml file to define the meaning of mapping:

(1).Start with "/"-->Path mapping
(2). "*. Do" front-& gt; extended mapping
(3). "/"-& gt; default service mapping.
(4). Detailed definition
& lt; url-pattern & gt;/*. Do & lt;/url-pattern & gt; / / "The beginning will match the path mapping and the extension mapping, causing the container to be unable to determine.

3.url-pattern matching rules

                                                                      (1). Exact path matching Mainly;



(2). Longest path matching

*,

                                                                                                                             servletB                                      

The above is the detailed content of Detailed explanation of the use of url-pattern in JavaWeb Servlet. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn