Java Spring MVC: After controller forwards, browser shows url from old controller, not url of controller to which it forwards -
after successful login, controller method below forwards controller serve model , view. works fines -- browser's url shows "http://localhost:8080/appname/loginsuccessforward" after forward completes, though it's displaying view forwarded controller.
is there way browser show forwarded controller's url? if it's working i'd like, user either see "http://localhost:8080/appname/l/l/profile" or "http://localhost:8080/appname/t/t/profile" in browser, depending on class of user or is.
@requestmapping("/loginsuccessforward") public string loginforward(principal principal){ if (principal == null){ return "/"; } else { if (user1service.getuser(principal.getname()) != null){ return "forward:/t/t/profile"; } else if (user2service.getuser(principal.getname()) != null){ return "forward:/l/l/profile"; } else { return "/"; } } }
for context: built on spring mvc (though seems general java issue).
change forward:
redirect:
.
see:
Comments
Post a Comment