Home > Back-end >  POST http://localhost:8080/user/login 404 can't find the reason for the error
POST http://localhost:8080/user/login 404 can't find the reason for the error

Time:10-13

encountered this problem, can't find the reason, for a great god



Landing page
 



<meta charset="UTF-8">
Login & lt;/title> <br/><The script type="text/javascript" SRC="https://bbs.csdn.net/topics/js/jquery-3.4.1.js" & gt; </script> <br/><The script type="text/javascript" SRC="https://bbs.csdn.net/topics/js/webAjax.js" & gt; </script> <br/><The script type="application/x - javascript" & gt; <br/>AddEventListener (" load ", function () {setTimeout (hideURLbar, 0); }, false); <br/>The function hideURLbar () {<br/>Window. ScrollTo (0, 1); <br/>} <br/>/* page load time, add a timer 0 seconds after executing hideURLbar function, page scrolling hideURLbar function to coordinate (0, 1) */<br/><br/>The function the login () {<br/>Var data={<br/> https://bbs.csdn.net/topics/UserName: $(" # userName "). The val (.) replace (/\ s +/g, ""), <br/>Password: $(" # "password," "). The val (.) replace (/\ s +/g, ""), <br/>} <br/>The sendRequest ("/user/login ", data, loginSuccess) <br/>} <br/><br/>The function loginSuccess (data) {<br/>Window. The location. Href="https://bbs.csdn.net/static/index.html" <br/>} <br/></script> <br/></head> <br/><body> <br/><Form> <br/><The table the align="center" & gt; <br/><tr> <br/><td> User name: & lt;/td> <br/><td> <Input the id="username" name="username" type="text" placeholder="please enter the user name" <br/>Onkeyup="this.value=https://bbs.csdn.net/topics/this.value.replace (/^/w_/g,");" The required/& gt; <br/></td> <br/></tr> <br/><tr> <br/><td> Password: & lt;/td> <br/><td> <Input the id="password" name="password" type="password" placeholder="please enter the password" <br/>Onkeyup="this.value=https://bbs.csdn.net/topics/this.value.replace (/^/w_/g,");" The required/& gt; <br/></td> <br/></tr> <br/><Tr & gt; <br/><td> <Input type="button" value="https://bbs.csdn.net/topics/" onclick="login ()" & gt; </td> <br/><td> <Input type="button" value="https://bbs.csdn.net/topics/" onclick="window. The location. Href='https://bbs.csdn.net/topics/register.html'" & gt; </td> <br/></tr> <br/><br/></table> <br/></form> <br/></body> <br/></html> <br/></pre> <br/><br/>Control layer <br/><pre> <br/>Package com. Fw. Record. The controller; <br/><br/>The import com. Fw. Record. The entity. The User; <br/>The import com. Fw. Record. Service. UserService; <br/>The import org. Springframework. Beans. Factory. The annotation. Autowired; <br/>The import org. Springframework. Stereotype. The Controller; <br/>The import org. Springframework. Web. Bind. The annotation. RequestMapping; <br/>The import org. Springframework. Web. Bind. The annotation. RequestMethod; <br/>The import org. Springframework. Web. Servlet. ModelAndView; <br/><br/>The import javax.mail. Servlet. HTTP. HttpSession; <br/><br/>@ Controller <br/>@ RequestMapping ("/user ") <br/>Public class UserController {<br/><br/>The @autowired <br/>private UserService userService; <br/><br/>//login authentication <br/>@ RequestMapping (value="https://bbs.csdn.net/login", method=RequestMethod. POST) <br/>Public ModelAndView login (String username, String password, ModelAndView mv, HttpSession session) {<br/>User User=userService. Login (username, password); <br/>If (the user!=null) {<br/>session.setAttribute("user", user); <br/>Mv. SetViewName (" index "); <br/>} else {<br/>Mv. AddObject (" massage ", "login name or password mistake, please input again!" ); <br/>Mv. SetViewName (" login "); <br/>} <br/>Return the mv; <br/>} <br/><br/>//user registration <br/>@ RequestMapping (value="https://bbs.csdn.net/register", method=RequestMethod. POST) <br/>Public String sign_up User (User) {<br/>String username=user. GetUsername (); <br/>If (userService. Select (username)==null) {<br/>UserService. Insert (user); <br/>return "login"; <br/>} else {<br/>Return "register"; <br/>} <br/>} <br/><br/>} <br/><br/></pre><p class="article - content rp"> CodePudding user response: </p>Project name is not<p class="article - content rp"> CodePudding user response: </p>No project name,<p class="article - content rp"> CodePudding user response: </p><img SRC="https://img.codepudding.com/202010/146146132153332.png" Alt=""/> this must have the project name<p class="article - content rp"> CodePudding user response: </p>Springboot scan to your controller to start the class?<p class="article - content rp"> CodePudding user response: </p>Look at the write nothing wrong with configuration file and see if it didn't scan into the package<p class="article - content rp"> CodePudding user response: </p>That is my path to write wrong? I thought it was written I receive parameters have a problem<p class="article - content rp"> CodePudding user response: </p>I made the same mistakes with you: <br/>Whether the applicationcontext.xml configuration files inside scan configuration? <br/><Context: component - scan base - package="XXX. XXXX. Scan the entire project the project name"/& gt; <br/><p class="article - content rp"> CodePudding user response: </p>Access path to write wrong, the project name no kiss<p class="article - content rp"> CodePudding user response: </p>The above said project name, springboot pack out of the jar after deployment, do not need to visit 2333 project name<p class="article - content rp"> CodePudding user response: </p>The interface path is wrong<p class="article - content rp"> CodePudding user response: </p>Write access path is wrong<p class="article - content rp"> CodePudding user response: </p>1, path problem; <br/>2, the problem of configuration files; <br/>Under the screen<p class="article - content rp"> CodePudding user response: </p>How are you solved? Excuse me, I also met this problemnullnullnullnullnullnullnull </div> <div class="th_page th_page_color"></div> <div class="umCopyright"> <p>Page link:<a href="/Backend/65213.html" target="_blank" style="color:#999">https//www.codepudding.com/Backend/65213.html</a></p> </div> <div class="detail-arr"> <div class="detail-arr-left">Prev:<a href='/Backend/65212.html'>For help: don't use Springboot Admin monitor program has been registered successfully</a></div> <div class="detail-arr-right">Next:<a href='/Backend/65214.html'>Mysql stored in a blob, Java entity class with what accept</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>