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("redirect:dashboard.do");


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






Post a Comment

If you have any doubt in programming or join online classes then you can contact us by comment .

Previous Post Next Post