Redirect from one page to another in Spring MVC


If we want to perform redirection into the spring MVC web application then we can use the redirect keyword under ModelAndView class Object and define the path of the controller.

suppose you want to create a login form and implement redirection after successful login then also we should use a redirect.

redirect also use browser cookie because it will redirect the page after browser instruction.

we will use ModelAndView class to implement Redirection from one web page to another.

we will write a redirect method under Model and View

return new ModelAndView("");

This code should be written on the Controller classes method, especially on login and logout operation.


Post a Comment


POST Answer of Questions and ASK to Doubt

Post a Comment (0)