1.<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
By spring servlet to load configuration file
2.<init-param>
<Param-name> contextConfigLocation </ param-name> // contextConfigLocation DispatcherServlet properties to pass a value type
<Param-value> classPath: springMVC.xml </ param-value> // The configuration file can be loaded into the configuration file is scanned the following
</init-param>
<Load-on-startap> / </ load-on-startap> // The above represents a transmission request is created, where the boot server can create an object DispatcherServlet
3. We know that in general there are the following springMVC.XML profile steps
<-! Open comments Scan ->
<context:context-scan base-package="cn.itcase"/>
<-! View parser object ->
<bean id=" " class=" ">
<property name="prefix" value="/WEB-INF/pages/"/>
<property name="sufix" value=".jsp"/>
</bean>
<-! SpringMVC open framework annotation support ->
<MVC:annotation-driven/>
4.RequestMapping
@RequestMapping(path="hello">
public string sayHello(){
sout("HAHA");
return "success";
}
example:
There are in XXX.jsp
<a href="user/testrequestMapping?username=XXX">注解</a>
And XXX java code must correspond to the same parameters in order to pass over
@RequestMapping(Value="/testquestMapping",params={“username=XXX"}