HTTP状态405-请求方法'GET'不支持呢
为什么我controller层用的标签是postMapping,然后html中也是post,然后执行了以后出现405状态呢 @Controller("myFrist") public class MyFrist { @PostMapping("/p") @ResponseBody public String postMapping(String name,String password) { System.out.println(name+":"+password); return name+ ":" + password; } @GetMapping("/g") @ResponseBody public void getMapping() { System.out.println("this is get method"); } } <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <form action="/p" method="post"> <h3>用户登陆界面</h3> 用户名<input name="name" type="text"/></br> 密码 <input name="password" type="password"/></br> <input type="submit" value="提交"/> </form> </body> </html>
正在回答 回答被采纳积分+1
2020-06-04 05:39:27,075] Artifact frist:war exploded: Artifact is deployed successfully
[2020-06-04 05:39:27,077] Artifact frist:war exploded: Deploy took 4,910 milliseconds
六月 04, 2020 5:39:27 下午 org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver handleHttpRequestMethodNotSupported
警告: Request method 'GET' not supported
六月 04, 2020 5:39:27 下午 org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver handleHttpRequestMethodNotSupported
警告: Request method 'GET' not supported
六月 04, 2020 5:39:31 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory E:\apache-tomcat-7.0.52\webapps\manager
六月 04, 2020 5:39:39 下午 org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver handleHttpRequestMethodNotSupported
警告: Request method 'GET' not supported
- 参与学习 人
- 提交作业 323 份
- 解答问题 8263 个
本阶段将带你学习主流框架SSM,以及SpringBoot ,打通成为Java工程师的最后一公里!
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星