A little knowledge about web.xml URL mapping __web

Source: Internet
Author: User

A little knowledge of URL mappings for Web.xml in Springmvc and struts2:

The STRUTS2 filter only accepts requests for no suffix or suffix action, Strutsprepareandexecutefilter url-pattern best Configured "/*"

The SPRINGMVC servlet is to configure "/" to handle other URL requests except for the. JSP suffix name, as well as static files (such as. css,.js.png)

SRINGMVC handles static resource access scenarios:

Objective: Static file can be accessed normally, no static file 404 can be found.

Scenario One: Activate Tomcat's defaultservlet to process static files



Features: 1. To configure multiple, each file is configured with one.

2. to write in front of the Dispatcherservlet, let Defaultservlet first intercept the request, so that the request will not enter Spring .

3. High performance.

Note:

Name of the default servlet with Tomcat, Jetty, JBoss, and GlassFish--"Default"
Google App Engine's default servlet name-"_ah_default"
Resin the name of the default servlet--"Resin-file"
WebLogic the name of the default servlet--"Fileservlet"
The name of the default servlet with WebSphere--"Simplefileservlet"

Programme II: Mvc:resources is available after the spring3.0.4 version, using the following methods:



images/** maps to Resourcehttprequesthandler for processing, location specifies the location of the static resource. Can be the Web application root directory, jar package, so you can compress the static resources into the jar package.


Programme III, using



"/" is used to indicate that the corresponding servlet is to apply the default servlet, and "/*" is used to indicate that all paths will be blocked by this servlet


<url-pattern>/</url-pattern>  does not match a suffix-type URL (but. css,,.js,.html match) with a pattern of *.jsp. If the corresponding servlet or filter is not found, it goes into the default Serlvet or filter
with the matching path configured as "/" <url-pattern>/*</url-pattern> Matches all URLs: path-and suffix-type URLs (including/login,*.jsp,*.js and *.html, etc.)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.