Request method ‘POST‘ not supported
今天看b站视频学项目时跟着老师敲,在运行后登陆时报了一个Request method ‘POST’ not supported错误,多方查询无果,最终发现是我的thymeleaf配戳了,于是写了这篇文章告诉大家如何定位错误1.既然是post请求出错,问题肯定是在提交表单的时候错了注意查看method和action是否写对了2.如果提交表单时没有出错,就看看自己controller层是否注释写错了参
·
今天看b站视频学项目时跟着老师敲,在运行后登陆时报了一个Request method ‘POST’ not supported错误,多方查询无果,最终发现是我的thymeleaf配戳了,于是写了这篇文章告诉大家如何定位错误
1.既然是post请求出错,问题肯定是在提交表单的时候错了
注意查看method和action是否写对了
2.如果提交表单时没有出错,就看看自己controller层是否注释写错了
参考代码如下
3.也有可能是引用class类出了问题
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
更多推荐
所有评论(0)