SpringBoot 后台重定向
亲测有效。
环境:weblogic、
步骤:
- pom文件中引入
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency>
- application.properties文件中增加如下配置
spring:
mvc:
view:
prefix: /view/
suffix: .html
mvc配置
prefix:/ 代表要访问的页面在reaources根目录下存放;
如果存放在二级目录view下需要将文件夹名加进去。如下:prefix: /view/
也可在controller返回页面时加此前缀文件夹名。如下:return "/view/index"。
上面一段配置信息转自链接:https://blog.csdn.net/InterceptWall/article/details/103841642.
- 使用 @Controller 注解而不是 @RestController
- 在src/resources/template文件夹下新建html文件,如test.html
- 在controller类里直接写如下代码即可。
return "test";
- 碰到的一个问题,集成另一系统是通过Iframe框架框住的,在另一系统超时后要退出重新登录时,登录页面被框到了Iframe框中,搜索一番后,找到了答案:(多谢)
https://blog.csdn.net/u010513756/article/details/46440153/.
截图:
见上图,我因为要跳转到另一个系统的登录页,所以直接在Html里面直接修改链接地址到另一系统了。