Can Spring Controller change the url of browser? -


i using spring controllers return name of views, this:

    @requestmapping(value = {"/login","/login.do"}) public modelandview showloginform(httpservletrequest request, httpservletresponse response) throws ioexception {      string username = getusername();     if(!username.equals("anonymoususer")){         return new modelandview("redirect:/home");      }     return new modelandview("login"); } 

my application running in domain (example) www.localhost:8080/app/home , after second login, need invalidade first login , redirect www.localhost:8080/app/login. possible in server code?

if in home page , return new modelandview("login"), browser url isn't modified. why?

i have same problem , use this:

return new modelandview(new redirectview("login")); 

if it's not work case, can try absolute path.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -