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 ...
随机推荐
- Paper Reading: Perceptual Generative Adversarial Networks for Small Object Detection
Perceptual Generative Adversarial Networks for Small Object Detection 2017-07-11 19:47:46 CVPR 20 ...
- (zhuan) 一些RL的文献(及笔记)
一些RL的文献(及笔记) copy from: https://zhuanlan.zhihu.com/p/25770890 Introductions Introduction to reinfor ...
- 【OData】使用Odata获取数据之后再次获取可能得不到最新的数据问题记录
工作上遇到个问题是关于系统后台数据库更新了某数据后, 前台界面刷新显示的不是最新的数据.但是大约10分后再次刷新就能显示新的数据,或者重启IIS等web server host. 最开始认为可能是因为 ...
- 解析Django路由层URLconf
目录: 一 Django中路由的作用 二 路由的分组 三 路由分发 四 反向解析 五 名称空间 六 Django2.0版的path 一.Django中路由的作用 URL配置(URLconf ...
- 51nod 1366 贫富差距(flody)
http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1366 题意: 思路: 如果不是一个连通块的话,肯定是无穷大的. 用flo ...
- HDU 1403 Longest Common Substring(最长公共子串)
http://acm.hdu.edu.cn/showproblem.php?pid=1403 题意:给出两个字符串,求最长公共子串的长度. 思路: 刚开始学后缀数组,确实感觉很难,但是这东西很强大,所 ...
- MVC ---- 怎删改查
using Modelsop; using System; using System.Collections.Generic; using System.Linq; using System.Web; ...
- Runnable、Callable、Executor、Future、FutureTask关系解读
在再度温习Java5的并发编程的知识点时发现,首要的就是把Runnable.Callable.Executor.Future等的关系搞明白,遂有了下述小测试程序,通过这个例子上述三者的关系就一目了然了 ...
- input标签让光标不出现
<input class="red" readonly unselectable="on" > input点击变为搜索框,用form包住绑定搜索事 ...
- 关于System.in如何执行的问题
import java.io.IOException; public class Test1 { public static void main(String[] args) throws IOExc ...