1.Ant-style request mapping
2.Rest Style
Increase (POST) Delete (delete) change (PUT) Check (GET)
but a label or form form, all only post, get two kinds of requests
So : Introduce Hiddenhttpmethodfilter filters to filter all requests:
GET Request---> Continue execution
POST Request---> Find out if there is a parameter named "_method" in the pass. There is no post execution, and there is a request in accordance with the parameters of the communication.
Put request:
<form>
<input type= "hidden" name= "_method" value= "PUT"/>
<input type= "text" name= "id" value = "/>
" ... </form>
Delete request:
<form>
<input type= "hidden" name= "_method" value= "DELETE"/>
<input type= "text" Name= "id" Value= "/>
" ... </form>
Configure the Hiddenhttpmethodfilter filter in Web. xml:
<filter>
<filter-name>hiddenHttpMethodFilter</filter-name>
<filter-class> org.springframework.web.filter.hiddenhttpmethodfilter</filter-class>
</filter>
< filter-mapping>
<filter-name>hiddenHttpMethodFilter</filter-name>
<url-pattern>/* </url-pattern>
</filter-mapping>
3.Servlet API
Background Request Method:
@RequestMapping (value= "...") Public
String test (httpservletrequest request,httpservletresponse response) {
return "Success";
}
4.SPRINGMVC Internationalization:
1. The foreground JSP writes:
2.springmvc.xml in configuration: (Note id= "Messagesource")
Notes:
5. Some request mappings directly jump to the page, do not need to go backstage request Java code
You can directly configure the map to Physical view page in Springmvc.xml, such as: request/ABCDEFG jump directly to aa.jsp
<mvc:view-controller path= "/ABCDEFG" view-name= "AA"/>
<!--precautions: in Springmvc.xml
If a <mvc:view-controller>! is configured for a mapping
The other controller methods will fail ...
So configure the <mvc:annotation-driven> again, and make the other controller methods valid:
-
<mvc:view-controller path= "/ABCDEFG" view-name= "AA"/>
<mvc:annotation-driven></mvc: Annotation-driven>
<mvc:view-controller>, <mvc:annotation-driven> to appear in pairs.