1. Configure the Web. XML (here configuration Url-pattern/)
<!--Coded Filters - <Filter> <Filter-name>Characterencodingfilter</Filter-name> <Filter-class>Org.springframework.web.filter.CharacterEncodingFilter</Filter-class> <Init-param> <!--Change the existing encoding method to - <Param-name>Encoding</Param-name> <Param-value>UTF-8</Param-value> </Init-param> <Init-param> <!--Force use of this code in any case - <Param-name>Forceencoding</Param-name> <Param-value>True</Param-value> </Init-param> </Filter> <filter-mapping> <Filter-name>Characterencodingfilter</Filter-name> <Url-pattern>/*</Url-pattern> </filter-mapping> <!--Central Scheduler - <servlet> <Servlet-name>Springmvc</Servlet-name> <Servlet-class>Org.springframework.web.servlet.DispatcherServlet</Servlet-class> <Init-param> <Param-name>Contextconfiglocation</Param-name> <Param-value>Classpath:applicationContext.xml</Param-value> </Init-param> <Load-on-startup>1</Load-on-startup> </servlet> <servlet-mapping> <Servlet-name>Springmvc</Servlet-name> <Url-pattern>/</Url-pattern> </servlet-mapping>
2. Handling static resources in Applicationcontext.xml
<!--- < />
3. Configuring the Processor
Public class extends Abstractcontroller { @Override public Modelandview handlerequestinternal ( HttpServletRequest arg0, throws Exception { new Modelandview (); Mv.addobject ("MSG", "model returned by the processor"); Mv.setviewname ("one"); return mv; }}
4. Registering the processor
<!-- Register processor --> < bean id = "Frist" class = "Cn.cnsdhzzl.controller.MyController" > < property name = "Supportedmethods" value = "Get,post" ></ property > </ bean >
5. Configure the Simpleurlhandlermapping settings access path
<!--using simpleurlhandlermapping - <Beanclass= "Org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"> < Propertyname= "Mappings"> <Props> <propKey= "/simple">Frist</prop> </Props> </ Property> </Bean>
6. Access Address
Springmvc__simpleurlhandlermapping (processing the access address in the form of a key-value pair)