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 ...
随机推荐
- 题解——CF Manthan, Codefest 18 (rated, Div. 1 + Div. 2) T2(模拟)
题目要求很简单,做法很粗暴 直接扫一遍即可 注意结果会爆int #include <cstdio> #include <algorithm> #include <cstr ...
- 题解——HDU 1848 Fibonacci again and again
一道组合游戏的题目 SG函数的板子题 预处理出SG函数的值然后回答询问即可 代码 #include <cstdio> #include <algorithm> #include ...
- (zhuan) Building Convolutional Neural Networks with Tensorflow
Ahmet Taspinar Home About Contact Building Convolutional Neural Networks with Tensorflow Posted on a ...
- jquery 封装页面之间获取值
最近在项目中发页面传值比较繁琐.View → Control → View,或是Session.Cookie 的 感觉不是很好,于是封装了一个页面间的js方法,上码 $.extend({ reque ...
- Jedis使用
Jedis是java调用Redis的接口. 一.Maven中的jedis依赖包 <!-- https://mvnrepository.com/artifact/redis.clients/jed ...
- Jtest的简单使用
Jtest主要用于快速测试自己的代码是否正确 条件,导入相应的Jtest包 @Test public void test() { System.out.println(" ...
- 剖析Hadoop和Spark的Shuffle过程差异
一.前言 对于基于MapReduce编程范式的分布式计算来说,本质上而言,就是在计算数据的交.并.差.聚合.排序等过程.而分布式计算分而治之的思想,让每个节点只计算部分数据,也就是只处理一个分片,那么 ...
- python模块(3)
1.xml:实现不同语言或程序之间进行数据交换的协议 <data> <country name="Liechtenstein"> <rank upda ...
- 关于video.js不错的一篇博客,
博客地址: http://www.cnblogs.com/webenh/p/5815741.html
- mac软件
1. http://www.ifunmac.com/ 2.Mac安装软件时提示已损坏的解决方法 http://www.jianshu.com/p/3d04a2292fcd 3.mac以后有时间在装的软 ...