首页 > 编程语言 > 详细

java spring boot 跳转

时间:2021-05-07 12:23:25      阅读:18      评论:0      收藏:0      [点我收藏+]
@RequestMapping("/TestLink1")
@GetMapping
@PostMapping
@ResponseBody
public ModelAndView TestLink1()
{
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("TestLink2");
modelAndView.addObject("key222", 12345);
return modelAndView;

}
@RequestMapping("/TestLink2")
@GetMapping
@PostMapping
@ResponseBody
public String TestLink2(@RequestParam(required = true, defaultValue = "") String key222)
{
return key222;
}


@RequestMapping("/TestLink3")
@GetMapping
@PostMapping
@ResponseBody
public ModelAndView TestLink3()
{
return new ModelAndView("redirect:http://www.baidu.com");

}
@RequestMapping("/TestLink4")
@GetMapping
@PostMapping
public String TestLink4()
{
return "redirect:http://www.baidu.com";
}
@RequestMapping("/TestLink5")
@GetMapping
@PostMapping
public String TestLink5(HttpServletResponse response)
{
try {
response.sendRedirect("http://www.baidu.com");
} catch (IOException e)
{
e.printStackTrace();
}
return "";
}

java spring boot 跳转

原文:https://www.cnblogs.com/mrray/p/14738183.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!