@RequestMapping(value="/redir/authcode") public ModelAndView getAuthCode(){ String authUrl="https://openauth.alipay.com/oauth2/publicAppAuthorize.htm?app_id="+contant.APPID+"&scope=auth_user&redirect_uri="+contant.ENCODED_URL+""; return new ModelAndView(new RedirectView(authUrl)); }//重定向到外网地址
@Controller@RequestMapping("/redir")public class RedirController { @ResponseBody @RequestMapping(value="pay") public String redirect(){ return "redirect:/pay.html"; }}//这种方法无法跳转
@Controller@RequestMapping("/redir")public class RedirController { @ResponseBody @RequestMapping(value="pay") public ModelAndView redirect(){ return new ModelAndView("redirect:/pay.html"); }}//正确方法
@Controllerpublic class RedirController { @RequestMapping(value="/redir/pay") public String redirect(){ return "redirect:/pay.html"; }}//正确跳转方式