springboot整合shiro之post提交不可用

整合部分我们直接跳过我们直接看问题

There was an unexpected error (type=Method Not Allowed, status=405).
这是在login的form表单post提交跳转后访问页面的情况,当我们使用get提交时
没有问题。
看看我们当时的webapp目录结构
没有使用模板引擎
我发现success放在static下面只能使用get请求才能访问到,当时我并未使用模板引擎,所以我想可能是因为shiro有自己的标签,所以我们只能在使用了模板引擎的页面中访问它,我们使用thymeleaf引擎加上依赖。

<dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-thymeleaf</artifactId></dependency>

目录结构在resource里添加目录templates。然后把success.html移动到templates下,再看目录。
thymeleaf
现在我们login
在这里插入图片描述
springboot默认解析templates下面的页面,其他的都是静态页面,而templates目录相当于tomcat的WEB-INF目录,不能直接访问,所以我们再使用Shiro的时候需慎重。

可能小弟的理解有什么偏差,欢迎大佬指出

猜你喜欢

转载自blog.csdn.net/qq_27275851/article/details/94307556