Spring MVC项目中页面重定向一般使用return "redirect:/other/controller/";即可。而Spring Boot使用了@RestController注解,上述写法只能返回字符串,解决方法如下:

将一个HttpServletResponse参数添加到处理程序方法然后调用response.sendRedirect("some-url");

@RestController
public class FooController { @RequestMapping("/foo")
void handleFoo(HttpServletResponse response) throws IOException {
response.sendRedirect("some-url");
} }

参考:

https://stackoverflow.com/questions/29085295/spring-mvc-restcontroller-and-redirect

最新文章

  1. Oracle学习笔记十 使用PL/SQL
  2. Ionic的跨域问题
  3. Linux磁盘管理之设备文件详解04
  4. 升級 Centos 6.5 的 php 版本
  5. MVC中你必须知道的13个扩展点
  6. 关于 NPOI 报 Invalid column index (256). Allowable column range for BIFF8 is (0..255) or ('A'..'IV') 错误的解决办法
  7. Python爬虫学习笔记——豆瓣登陆(三)
  8. ubuntu 启用apache2 虚拟机配置
  9. poj 1118 Lining Up(水题)
  10. Bootstrap按钮插件
  11. JS基础--函数与BOM、DOM操作、JS中的事件以及内置对象
  12. CodeForces 918D MADMAX(博弈+记忆化搜索)
  13. Django中数据查询(万能下换线,聚合,F,Q)
  14. .Net Linq与Lambda表达式中GroupBy以多个字段分组
  15. [Linux] memache打印所有的key
  16. ipa的plist文件查看
  17. ntpdate[31915]: the NTP socket is in use, exiting
  18. python接口自动化测试六:时间戳,防重复处理
  19. SCS Characteristics
  20. 第二篇 windows container 微软的原生容器

热门文章

  1. 【POJ 1011】 Sticks
  2. How to add dependency on a Windows Service AFTER the service is installed
  3. 当Shell遇上了Node.js(转载)
  4. php的string编码类型
  5. 练习2 及pl/sql
  6. var的变量提升的底层原理是什么?
  7. mybatis parameterType报错:There is no getter for property named 'xxx' in 'class java.lang.String'
  8. AES && DES加解密
  9. jboss-as-7.1.1.Final配置Jndi数据源(以mysql为例)
  10. Android ViewPager使用方法小结