0

In My Controller file.

@RequestMapping(value = "/login", method = RequestMethod.GET)
    public String login() {
        Subject currentUser = SecurityUtils.getSubject();
        if (currentUser.isAuthenticated()) {
            return "redirect:/account/center";
        }
        return "public/login";
    }

After Then I login, and I input /login in the location bar, and redirect the /account/center. But the url in the location bar show detail infomation. eg:http://localhost:8080/account/center?controllerName=com.xxx.test.HomeController&controllerAction=login&controllerPath=%2Flogin.

How to hide controllerName,controllerAction,controllerPath in the redirect.

venlentine
  • 17
  • 8
  • Use HTTP post parameters. – t-my Mar 28 '14 at 08:42
  • Refer http://stackoverflow.com/questions/17676206/spring-3-0-mvc-redirect-without-parameters-being-added-to-my-url as well as http://stackoverflow.com/questions/13247239/spring-mvc-controller-redirect-without-parameters-being-added-to-my-url – Balwinder Singh Mar 28 '14 at 08:44
  • Thank you!but can't useful.The parameter `controllerName,controllerAction,controllerPath` not I add, is springmvc auto add. – venlentine Mar 28 '14 at 09:25

1 Answers1

0

If you don't want to get parameter through URL then you use HTTP Method as POST

@RequestMapping(value = "/login", method = RequestMethod.POST)
public String login() {
    Subject currentUser = SecurityUtils.getSubject();
    if (currentUser.isAuthenticated()) {
        return "redirect:/account/center";
    }
    return "public/login";
}