I noticed that the following code redirects the user to a URL inside the project,
@RequestMapping(method = RequestMethod.POST) public String processForm(HttpServletRequest request, LoginForm loginForm, BindingResult result, ModelMap model) { String redirectUrl = "yahoo.com"; return "redirect:" + redirectUrl; }
whereas the following is redirected properly as intended, but requires http: // or https: //
@RequestMapping(method = RequestMethod.POST) public String processForm(HttpServletRequest request, LoginForm loginForm, BindingResult result, ModelMap model) { String redirectUrl = "http://www.yahoo.com"; return "redirect:" + redirectUrl; }
I want the redirect to always be redirected to the specified URL, whether it has a valid protocol in it or not, and does not want to redirect to the view. How can i do this?
Thank,
java spring spring-mvc jsp
Jake Jul 30 '13 at 19:32 2013-07-30 19:32
source share