重定向求助?
想请教下springboot下不使用模板引擎怎么进行html页面重定向?(使用springboot默认的项目结构)
想请教下springboot下不使用模板引擎怎么进行html页面重定向?(使用springboot默认的项目结构)
2017-01-16
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
/**
* @version 1.0 2017/1/17
* @since 1.0
*/
@RestController
public class HelloController {
@GetMapping(value = "/hello")
@ResponseBody
public ModelAndView say() {
return new ModelAndView("redirect:http://www.imooc.com");
}
}举报