Reputation: 369
I've been googling a while and I couldn't find a clear answer or documentation about this specific method.
I want to redirect to another site, like stackoverflow.com using this method... But I don't know how to do it. Any help will be appreciated.
@RequestMapping(value = "/redirectTravelocity", method = RequestMethod.GET)
private ModelAndView processForm()
{
ModelAndView modelAndView = new ModelAndView( "redirect:stackoverflow.com" );
Map<String, Object> model = modelAndView.getModel();
model.put( "error", "this.is.my.error.code" );
return new ModelAndView( "redirect:stackoverflow.com", model );
}
It doesn't work, it redirects within my site and it crashes... I know this is stupid but I don't know how to do it.
Upvotes: 6
Views: 7383
Reputation: 723
change redirect:stackoverflow.com
to redirect:http://stackoverflow.com
Upvotes: 0
Reputation: 3525
Here is one way to do it:
@RequestMapping(value = "/redirectTravelocity", method = RequestMethod.GET)
private String processForm()
{
return "redirect:http://stackoverflow.com";
}
Upvotes: 7