转发:forward

@RequestMapping("index")
public String index(ModelMap map, HttpServletRequest request) {
return "forward:/new";
}

@RequestMapping("new")
public String new(ModelMap map, HttpServletRequest request) {
return "new";
}



重定向:redirect

@RequestMapping("logout")
public String logout(HttpServletRequest request, HttpServletResponse response, HttpSession session) {
// 清除session
session.invalidate();

// 重定向到登录页面
return "redirect:/login";
}





回到顶部