@RequestMapping("/redirctPage")
public ModelAndView redirctPage(){
if (isLogin()){
//页面名称
ModelAndView modelAndView = new ModelAndView("UserAuth");
return modelAndView;
}else {
//未登录重定向到登陆页面
//地址
ModelAndView modelAndView = new ModelAndView("redirect:/login");
return modelAndView;
}
}
SpringBoot的后端携带url重定向
最新推荐文章于 2025-11-10 22:16:24 发布
此篇博客介绍了如何使用Spring MVC处理用户登录状态,通过`@RequestMapping(/redirctPage)`方法,当用户已登录时,转向用户授权页面;未登录则重定向至登录界面。
1675

被折叠的 条评论
为什么被折叠?



