UserController. Java
Package com. SSM. Controller;
The import javax.mail. Servlet. HTTP. It;
The import org. Springframework. Stereotype. The Controller;
The import org. Springframework. Web. Bind. The annotation. RequestMapping;
//@ Controller annotation
@ Controller
Public class UserController {
//@ RequestMapping annotation on the method
@ RequestMapping (value="https://bbs.csdn.net/selectUser")
Public String selectUser (it request) {
//get request address the value of the parameter id
String id=request. The getParameter (" id ");
System. The out. Println (" id="+ id);
return "success";
}
}
XML for springmvc - config.
<? The XML version="1.0" encoding="utf-8"?>
XMLNS: context="http://www.springframework.org/schema/context"
XMLNS: MVC="http://www.springframework.org/schema/mvc"
Xsi: schemaLocation="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/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd "& gt;
Web.xml
<? The XML version="1.0" encoding="utf-8"?>
Xsi: schemaLocation="http://java.sun.com/xml/ns/javaee
"
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsdId="WebApp_ID" version="3.0" & gt;
ContextConfigLocation
The classpath: for springmvc - config. Xml
Success. The JSP
<% @ page language="Java" contentType="text/HTML. Charset=utf-8 "pageEncoding=" utf-8 "% & gt;
"Http://www.w3.org/TR/html4/loose.dtd" & gt;
<meta HTTP - equiv="content-type" Content="text/HTML. charset=UTF-8">
<body>
ok! , the implementation of successful,