如何使用SpringBeanNameViewResolver重定向到URL

如何使用SpringBeanNameViewResolver重定向到URL,spring,redirect,model-view-controller,Spring,Redirect,Model View Controller,在使用BeanNameViewResolver时,是否可以重定向到SpringMVC控制器内的另一个URL? 也许在某种程度上只是逃避bean名称解析 这显然只适用于UrlBasedViewResolver @RequestMapping(value = "/**", method = RequestMethod.GET) public ModelAndView postPage(HttpServletRequest req){ return "redirect:http://local

在使用BeanNameViewResolver时,是否可以重定向到SpringMVC控制器内的另一个URL? 也许在某种程度上只是逃避bean名称解析

这显然只适用于UrlBasedViewResolver

@RequestMapping(value = "/**", method = RequestMethod.GET)
public ModelAndView postPage(HttpServletRequest req){
    return "redirect:http://localhost:9090/flowID";
}
找到了答案

    @RequestMapping(value = "/**", method = RequestMethod.GET)
public View postPage(HttpServletRequest req, Map<String, Object> model){
    RedirectView redirectView = new RedirectView("http://localhost:9090/flowID");
    return redirectView;
}
@RequestMapping(value=“/**”,method=RequestMethod.GET)
公共视图后期页面(HttpServletRequest请求,映射模型){
RedirectView RedirectView=新建重定向视图(“http://localhost:9090/flowID");
返回重定向视图;
}