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 ...
随机推荐
- 用dbms_scheduler创建job
以前一般使用dbms_job来创建job,oracle10g以后推荐使用dbms_scheduler来创建定时任务,dbms_scheduler功能更为强大.一个创建job的例子: begin sys ...
- 题解——POJ 2234 Matches Game
这道题也是一个博弈论 根据一个性质 对于\( Nim \)游戏,即双方可以任取石子的游戏,\( SG(x) = x \) 所以直接读入后异或起来输出就好了 代码 #include <cstdio ...
- (zhuan) Paper Collection of Multi-Agent Reinforcement Learning (MARL)
this blog from: https://github.com/LantaoYu/MARL-Papers Paper Collection of Multi-Agent Reinforcemen ...
- maven web项目生成WebContent或WebRoot目录
本文为博主原创,转载请注明出处: 新建maven web工程时,自动生成的文件结构目录如下: 这个是maven web自动生成的目录结构,我想让其生成如java web工程的WebRoot 或WebC ...
- 【链接】linuxCentOS权限问题修复(chmod777-R或者chmod755- http://www.cnblogs.com/kofxxf/p/5220836.html
[链接]linuxCentOS权限问题修复(chmod777-R或者chmod755- http://www.cnblogs.com/kofxxf/p/5220836.html
- Educational Codeforces Round 23 F. MEX Queries 离散化+线段树
F. MEX Queries time limit per test 2 seconds memory limit per test 256 megabytes input standard inpu ...
- JVM(一)
1 Java类加载器包括几种?它们之间的关系是怎么样的?双亲委派机制是什么意思?有什么好处? 启动Bootstrap类加载.扩展Extension类加载.系统System类加载. 类加载器也是Java ...
- mysql-5.6.41-winx64安装
安装包 链接:https://pan.baidu.com/s/11-Ts3SrfJViQEtdtI_ik9w 提取码:cxt3 1.解压 将下载好的mysql-5.6.41-winx64.zip的安装 ...
- cin 与 getchar 中的坑
今天在一道题上发现一个坑. 输入三个字符,按以下规则求其平均值. (1)如果是数字0~9,那么直接参与求值: (2)如果是其他字符,则其ASCII码参与求值. 输入 输入数据有多组.第一行是数据的组数 ...
- linux c/c++ 文件是否存在
linux c/c++ 文件是否存在 #include <unistd.h> int FileExist(const char* fname) { return access(fname, ...