Home > Back-end >  Bosses for help, in the spring framework, but no error code 404
Bosses for help, in the spring framework, but no error code 404

Time:05-01


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: xsi="http://www.w3.org/2001/XMLSchema-instance"
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"?>
XMLNS="http://java.sun.com/xml/ns/javaee"
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;

Springmvc

Org. Springframework. Web. Servlet. DispatcherServlet

ContextConfigLocation
The classpath: for springmvc - config. Xml

1


Springmvc
/& lt;/url - pattern>



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">
Entry procedures & lt;/title> <br/></head> <br/><body> <br/>ok! , the implementation of successful, <br/></body> <br/></html> <br/> </div> <div class="th_page th_page_color"></div> <div class="umCopyright"> <p>Page link:<a href="/Backend/109904.html" target="_blank" style="color:#999">https//www.codepudding.com/Backend/109904.html</a></p> </div> <div class="detail-arr"> <div class="detail-arr-left">Prev:<a href='/Backend/109903.html'>Shiro springboot integration</a></div> <div class="detail-arr-right">Next:<a href='/Backend/109944.html'>C language problem urgent request</a></div> </div> </div> </div> </div> </div> <div class="container th_top"> <div class="row"> <div class="col-md-12"> <div class="hot-tags neitags"> <ul> <li><i class="iconfont icon-x-tags"></i> Tags:  </li> <a href='/e/tags/?tagname=Web+development' target='_blank'>Web development</a> </ul> </div> </div> </div> </div> <div class="container th_top"> <div class="row"> <div class="col-md-12"> <div class="xiangguan"> <ul class="msg msghead"> <li class="tbname">Related</li> </ul> <ul> </ul> </div> </div> </div> </div> <div class="container th_top"> <div class="row"> <div class="col-md-12"> <div class="flinks"> <ul> <li><i class="iconfont icon-x-tags"></i> Links:  </li> <li class="liflinks"><a target="_blank" href="/" title="CodePudding">CodePudding</a></li> </ul> </div> </div> </div> </div> <div class="footer"> <p><span style="font-size:16px;color:#666;font-weight: bold">About Us:</span>  <a href="https://www.codepudding.com/contact.html">Contact Us</a>      <a href="https://www.codepudding.com/service.html">Terms of Service</a>      <a href="https://www.codepudding.com/privacy.html"> Privacy Policy</a></p> <p class="foot_info">Copyright © 2010-2023,Powered By <a href="/" target="_blank">CodePudding</a> </p> </div> <script type="text/javascript" src="/skin/code/tianhu.js"></script> </body></html>