---
title: "springboot restcontroller thymeleaf 页面跳转"
author: "45571845"
date: "2018-03-21T13:45:40Z"
tags: []
categories: ["编程语言"]
slug: "springboot-restcontroller-thymeleaf"
draft: false
lastmod: "2018-03-21T13:45:40Z"
id: 2414111
url: "https://j2ees.iteye.com/blog/2414111"
---

thymeleaf 推荐使用 @Controller  进行页面跳转。

 

如果用@RestController 怎么进行页面跳转呢？

 

代码如下：

```
@RestController
@RequestMapping("rmsLogin")
public class RmsLoginController {

    @RequestMapping("login")
    public ModelAndView forwardLogin(){
        ModelAndView mv = new ModelAndView();
        mv.setViewName("rms/login");
        return mv;
    }
}
```