I would like to know if there is a better way to to redirects in my Spring app.
At the moment, for example, my change password page could lead to either the error page or the main app page. Returning a new ModelAndView object of the relevant view works but does not update the browser url.
To get round this I use response.sendredirect():
However, I now have to keep the url in the controller upto date with the mappings in the servlet xml file:Code:... response.sendRedirect(request.getContextPath()+"/secure/main.htm"); return null;
ThanksCode:<bean name="/secure/main.htm" class="com.ifst.web.controllers.MainPageController"/>