Home > Back-end >  For springmvc match/save handler method and this method returns is a success, will be forwarded to t
For springmvc match/save handler method and this method returns is a success, will be forwarded to t

Time:12-09

The Handler code

@ Controller
@ RequestMapping ("/test ")
Public class UserController {


@ RequestMapping (value="https://bbs.csdn.net/save", method=RequestMethod. POST)
Public String saveUser (User User) {
System.out.println(user);
Return "success";
}

@ RequestMapping (value="https://bbs.csdn.net/test", method=RequestMethod. POST)
Public String testUser with User (User) {
System.out.println(user);
System. The out. Println (" Oakley ");
Return "success";
}

@ RequestMapping (value="https://bbs.csdn.net/save01", method=RequestMethod. POST)
Public String saveUser1 User (User) {
System.out.println(user);
Return "success";
}

}


Index01.
JSP code
<% @ page language="Java" contentType="text/HTML. Charset=utf-8 "
PageEncoding="utf-8" % & gt;



<meta charset="utf-8" & gt;
The homepage & lt;/title> <br/></head> <br/><body> <br/><The form action="./test/save "method=" post "& gt; <br/>User name: & lt; Input name="loginName" type="text" & gt; <br> <br/>Password: & lt; Input name="loginPwd" type="text" & gt; <br> <br/>Provinces: & lt; Input name="address. The province" type="text" & gt; <br> <br/>City: & lt; The input name="address. City" type="text" & gt; <br> <br/><Input type="submit" value="submit" https://bbs.csdn.net/topics/& gt; <br/></form> <br/></body> <br/></html> <br/><br/>Index02. <br/> JSP code<br/><% @ page language="Java" contentType="text/HTML. Charset=utf-8 "<br/>PageEncoding="utf-8" % & gt; <br/><! DOCTYPE html> <br/><html> <br/><head> <br/><meta charset="utf-8" & gt; <br/><title> The homepage & lt;/title> <br/></head> <br/><body> <br/><The form action="./test/save01 "method=" post "& gt; <br/>User name: & lt; Input name="loginName" type="text" & gt; <br> <br/>Password: & lt; Input name="loginPwd" type="text" & gt; <br> <br/>Provinces: & lt; Input name="address. The province" type="text" & gt; <br> <br/>City: & lt; The input name="address. City" type="text" & gt; <br> <br/><Input type="submit" value="submit" https://bbs.csdn.net/topics/& gt; <br/></form> <br/></body> <br/></html> <br/><br/>Index03. <br/> JSP code<br/><% @ page language="Java" contentType="text/HTML. Charset=utf-8 "<br/>PageEncoding="utf-8" % & gt; <br/><! DOCTYPE html> <br/><html> <br/><head> <br/><meta charset="utf-8" & gt; <br/><title> The homepage & lt;/title> <br/></head> <br/><body> <br/><The form action="./test/test "method=" post "& gt; <br/>User name: & lt; Input name="loginName" type="text" & gt; <br> <br/>Password: & lt; Input name="loginPwd" type="text" & gt; <br> <br/>Provinces: & lt; Input name="address. The province" type="text" & gt; <br> <br/>City: & lt; The input name="address. City" type="text" & gt; <br> <br/><Input type="submit" value="submit" https://bbs.csdn.net/topics/& gt; <br/></form> <br/></body> <br/></html> <br/><br/><img SRC="https://img.codepudding.com/202012/175885090437581.png" Alt=""/> <br/><br/>Only access/save the complains, the other is not an error<p class="article - content rp"> CodePudding user response: </p>Which you in templete/test save. Try the JSP<p class="article - content rp"> CodePudding user response: </p><fieldset> <legend> reference 1/f, street vendors reply: <legend> <blockquote> which you in templete/test. Save the JSP try </blockquote> <fieldset> <br/>The key is to return to the logical view name is success<p class="article - content rp"> CodePudding user response: </p><fieldset> <legend> refer to the second floor wing の peterPen response: <legend> <blockquote> <fieldset> <legend> Quote: refer to 1st floor street vendor reply: <legend> <blockquote> which you in templete/test. Save the JSP try </blockquote> <fieldset> <br/>The key is to return to the logical view name is success </blockquote> <fieldset> <br/>You mean you configuration is wrong? Bug bug or spring spring<p class="article - content rp"> CodePudding user response: </p><fieldset> <legend> reference 3/f street vendor reply: <legend> <blockquote> <fieldset> <legend> Quote: refer to the second floor wing の peterPen response: <legend> <blockquote> <fieldset> <legend> Quote: refer to 1st floor street vendor reply: <legend> <blockquote> which you in templete/test save. Try JSP </blockquote> <fieldset> <br/>The key is to return to the logical view name is success </blockquote> <fieldset> <br/>You mean you configuration is wrong? Bug bug or spring spring </blockquote> <fieldset> <br/>To be honest I don't know, I feel there may be internal code save reserved words?<p class="article - content rp"> CodePudding user response: </p>HTML form tag is a synchronous, @ RequestMapping returns yes view information, return is called the view of success, so after submission will jump to view of success, but your view does not exist, so 404<p class="article - content rp"> CodePudding user response: </p><fieldset> <legend> reference 4 floor wing の peterPen response: <legend> <blockquote> <fieldset> <legend> Quote: refer to the third floor street vendor reply: <legend> <blockquote> <fieldset> <legend> Quote: refer to the second floor wing の peterPen response: <legend> <blockquote> <fieldset> <legend> Quote: refer to 1st floor street vendor reply: <legend> <blockquote> which you in templete/test save. Try JSP </blockquote> <fieldset> <br/>The key is to return to the logical view name is success </blockquote> <fieldset> <br/>You mean you configuration is wrong? Bug bug or spring spring </blockquote> <fieldset> <br/>To be honest I don't know, I feel there may be internal code save reserved words? </blockquote> <fieldset> <br/>Spring MVC in the document there is no mention of this aspect, there is no doubt that is your problem, you may not understand how it works<p class="article - content rp"> CodePudding user response: </p>Should be a static resource path problem, the relative position and absolute positionnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull </div> <div class="th_page th_page_color"></div> <div class="umCopyright"> <p>Page link:<a href="/Backend/93270.html" target="_blank" style="color:#999">https//www.codepudding.com/Backend/93270.html</a></p> </div> <div class="detail-arr"> <div class="detail-arr-left">Prev:<a href='/Backend/93269.html'>OracleTimeoutPollingThread how to solve?</a></div> <div class="detail-arr-right">Next:<a href='/Backend/93332.html'>Using a linked list implementation books management system management system</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>