[SPRINGMVC Operation Process]
[Handler annotation mapping tips]
[Detail handling of request method]
1. How do I handle binding of request parameters and method parameters?
2. How can I restrict how the method receives requests?
3. How do I forward and redirect requests?
4. How do I assign a value to a data model?
5. How do I return JSON data?
6. How do I get cookie data?
[SPRINGMVC's integrated configuration]
1. Configure the ingress Dispatcherservlet in Web. xml
<?XML version= "1.0" encoding= "UTF-8"?><Web-appxmlns= "Http://java.sun.com/xml/ns/javaee"Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"xsi:schemalocation= "Http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"version= "3.0"Metadata-complete= "true"> <!--Web-app created with Maven needs to modify the version of the servlet to 3.1 - <!--SPRINGMVC Configuration - <!--1: Configure Dispatcherservlet - <servlet> <Servlet-name>Seckill-dispatcher</Servlet-name> <Servlet-class>Org.springframework.web.servlet.DispatcherServlet</Servlet-class> <!--Configure SPRINGMVC Spring configuration file Mybatis, spring-SPRINGMVC - <Init-param> <Param-name>Contextconfiglocation</Param-name> <Param-value>Classpath:spring/spring-*.xml</Param-value> </Init-param> </servlet> <servlet-mapping> <Servlet-name>Seckill-dispatcher</Servlet-name> <!--all requests are matched by default - <Url-pattern>/</Url-pattern> </servlet-mapping></Web-app>
2.spring-web.xml Configuration
<?XML version= "1.0" encoding= "UTF-8"?><Beansxmlns= "Http://www.springframework.org/schema/beans"Xmlns:mvc= "Http://www.springframework.org/schema/mvc"Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"Xmlns:context= "Http://www.springframework.org/schema/context"xsi:schemalocation= "Http://www.springframework.org/schema/beans Http://www.springframework.org/schema/beans/spring-beans. XSD Http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd Http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd " > <!--SPRINGMVC Configuration - <!--1: Open springmvc annotation mode - <!--Simplified configuration: (1) Autoenrollment Defaultannotationhandlermapping,annotationmethodhandleradapter (2) provides some column functions: Data binding, number and date forma T @NumberFormat, @DateTimeFormat, xml,jsonm default read/write support - <Mvc:annotation-driven/> <!--2: Static resource Default servlet configuration (1) joins the processing of static resources: Js,gif,png (2) allows for overall mapping using "/" - <Mvc:default-servlet-handler/> <!--3: Configure JSP display Viewresovler - <Beanclass= "Org.springframework.web.servlet.view.InternalResourceViewResolver"> < Propertyname= "Viewclass"value= "Org.springframework.web.servlet.view.JstlView"/> < Propertyname= "prefix"value= "/web-inf/jsp"/> < Propertyname= "suffix"value= ". jsp"/> </Bean> <!--4: Scan Web-related beans - <Context:component-scanBase-package= "Org.azcode.web"/></Beans>
High concurrent second kill system--SPRINGMVC integration