The import org. Springframework. Stereotype. The Controller;
import org.springframework.web.bind.annotation.RequestMapping;
The import org. Springframework. Web. Bind. The annotation. RequestMethod;
The import org. Springframework. Web. Servlet. ModelAndView;
@ Controller
@ RequestMapping ("/system ")
Public class Conn {
@ RequestMapping (value="https://bbs.csdn.net/index", method=RequestMethod. GET)
Public ModelAndView index (ModelAndView model) {
//TODO Auto - generated constructor stub
Model. SetViewName (system/" index ");
Model. The addObject (" name ", "sadwad");
Return the model;
}
}
web. XML:
<? The XML version="1.0" encoding="utf-8"?>
Encoding
Utf-8 & lt;/param - value>
ForceEncoding
True
ContextConfigLocation
The classpath: config/spring/applicationContext. Xml
Log4jConfigLocation & lt;/param - name>
The classpath: config/log4j. Properties
ContextConfigLocation
The classpath: config/for springmvc/for springmvc. Xml
For springmvc. XML:
<? The XML version="1.0" encoding="utf-8"?>
XMLNS: MVC="http://www.springframework.org/schema/mvc" XMLNS: aop="http://www.springframework.org/schema/aop"
XMLNS: task="http://www.springframework.org/schema/task"
Xsi: schemaLocation="HTTP://http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.3.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.2.xsd "& gt;