springmvc 登陆后跳转到登陆前的画面

	@RequestMapping(value = "login", method = RequestMethod.GET)
	public String formTag(HttpSession session, HttpServletRequest request) {
		String url = request.getHeader("Referer");//获取上个页面的url
		session.setAttribute("redirectUrl", url);//把url放到session
		return "loginView";
	}

	@RequestMapping("login")
	public String login(HttpSession session) {
                //TODO 登陆验证
		String url = (String) session.getAttribute("redirectUrl");//登陆的验证通过后,在从session里获取前画面的url
		return "redirect:" + url;//转向到前画面
	}

你可能感兴趣的:(spring)