1, blocking the fixed suffix of the URL, such as set to *.do, *.action, for example:/user/add.action This method is the simplest, will not cause static resources (JPG,JS,CSS) to be intercepted.
2, intercept all, set to/, for example:/user/add/user/add.action
This approach allows you to implement restful URLs, which are used in many types of Internet applications.
However, this method causes the static file (JPG,JS,CSS) to be blocked and not displayed properly. Special handling is required.
mappings for static resource access for example: <mvc:resources location= "/resource/" mapping= "/resource/**"/>
Do not configure the processing of static resources, do the following configuration to resolve the problem of static resources:
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>/static/* </url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default </servlet-name>
<url-pattern>*.js</url-pattern>
</servlet-mapping>
< servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.css</ Url-pattern>
</servlet-mapping>
If possible, SPRINGMVC it is best not to intercept static resources, preferably let the Tomcat container handle itself.
3, intercept all, set to/*,<url-pattern>/*</url-pattern> if this setting is problematic because the request to the action, when the action is transferred to the JSP is intercepted again, Hint cannot mapping success based on JSP path.
In fact, you can also use the <url-pattern>/app/* </url-pattern> configuration.