org.springframework.web.bind.annotation重定向的问题
@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");
}
}
//正确方法
@Controller
public class RedirController { @RequestMapping(value="/redir/pay")
public String redirect(){
return "redirect:/pay.html";
}
}
//正确跳转方式
org.springframework.web.bind.annotation重定向的问题的更多相关文章
- Java-API-Package:org.springframework.web.bind.annotation
ylbtech-Java-API-Package:org.springframework.web.bind.annotation 1.返回顶部 1. @NonNullApi @NonNullField ...
- Java-Class-@I:org.springframework.web.bind.annotation.PostMapping
ylbtech-Java-Class-@I:org.springframework.web.bind.annotation.PostMapping 1.返回顶部 2.返回顶部 1. package ...
- Java-Class-@I:org.springframework.web.bind.annotation.RestController
ylbtech-Java-Class-@I:org.springframework.web.bind.annotation.RestController 1.返回顶部 2.返回顶部 1. pack ...
- Java-Class-@I:org.springframework.web.bind.annotation.RequestMapping
ylbtech-Java-Class-@I:org.springframework.web.bind.annotation.RequestMapping 1.返回顶部 2.返回顶部 1. pack ...
- Java-Class-@I:org.springframework.web.bind.annotation.RequestBody
ylbtech-Java-Class-@I:org.springframework.web.bind.annotation.RequestBody 1.返回顶部 2.返回顶部 1. package ...
- spring org.springframework.web.bind.annotation 常用注解
开发中常用的注解记录,查缺补漏 Request注解 @RequestBody @RequestHeader @RequestMapping @RequestParam @RequestPart @Co ...
- org.springframework.web.bind.annotation不存在 site:blog.csdn.net(IDEA中运行springboot时报错)
原因:MAVEN版本与IDEA版本不兼容问题, maven虽然更新比较慢,但是最新的3.6.6在与IDEA2019版本及以下版本兼容时会出现以上问题 解决办法:重新配置一个3.6低级别版本的maven ...
- org.springframework.web.bind.ServletRequestDataBinde
org.springframework.validation Class DataBinder java.lang.Object org.springframework.validation.Data ...
- 使用ControllerAdvice注意事项,Ambiguous @ExceptionHandler method mapped for [class org.springframework.web.bind.MethodArgumentNotValidException]
前言 ControllerAdvice非常好用,可以把系统内部的异常统一处理.用起来也很简单.比如,http://www.cnblogs.com/woshimrf/p/spring-web-400.h ...
随机推荐
- C++笔记(2018/2/6)
引用 & 某个变量的引用,等价于这个变量,相当于该变量的一个别名. 定义引用时一定要将其初始化成引用某个变量. 初始化后,它就一直引用该变量,不会再引用别的变量了. 通过引用所做的读写操作,会 ...
- Tomcat服务器环境变量配置及在Eclipse中启动和配置
本文原创,转载需注明出处: 如何配置在Eclipse中配置Tomcat服务器 1.在配置的时候要右击‘我的电脑‘看是否安装了jdk,配置了jdk的环境变量,看是否有classpath和path是否指向 ...
- 3、Python编程之MySQLdb模块(0602)
解释器环境与选项 python解释器启动 python [options] [ -c cmd | filename | - ] [ args ] python解释器环境变量 python代码的测试.调 ...
- shell中的${},##, %% , :- ,:+, ? 的使用
假设我们定义了一个变量为:file=/dir1/dir2/dir3/my.file.txt 可以用${ }分别替换得到不同的值:${file#*/}:删掉第一个/ 及其左边的字符串:dir1/dir2 ...
- 【Python】【有趣的模块】【Requests】无状态 & 无连接
无状态:原来的Web是静态,后来换成动态的就需要保存一些上下文信息,session和cookie应运而生 无连接:原来为了请求结束后赶紧把资源让出去,后来发现每次请求中有相同的小请求时候再重复执行(而 ...
- P2002 消息扩散
其实这道题蛮水的 思路: 根据题意,他说有环,自然想到要用tarjan,后面就很简单了: 缩完点之后重新建图,开一个inin数组表示该点的入度是多少(psps:该点表示缩完点之后的大点): 最后统计一 ...
- CentOS 7 安装pip2
使用yum安装python-pip,但是报错,说没有可用的包 安装epel源 [root@sishen yum.repos.d]# yum install -y epel-release 然后再安装 ...
- 3.git、TortoiseGit的安装、仓库的配置教程
参考:https://blog.csdn.net/hc_ttxs/article/details/79375788 引言: Git: 就是最原始的分布式版本控制系统,是开源的. GitHub:与Git ...
- Node.js 常用命令
1. 查看node版本 node --version 2. 查看npm 版本,检查npm 是否正确安装. npm -v 3. 安装cnpm (国内淘宝镜像源),主要用于某些包或命令程序下载不下来的情况 ...
- C# 图片人脸识别
此程序基于 虹软人脸识别进行的开发 前提条件从虹软官网下载获取ArcFace引擎应用开发包,及其对应的激活码(App_id, SDK_key)将获取到的开发包导入到您的应用中 App_id与SDK_k ...