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 ...
随机推荐
- js 通过id或class获得的对象说明
通过id获取的是一个对象 通过class获取的是一个数组 $($(".layui-tab-item layui-show")[0]).html(data)//实际测试没用. ...
- Validation in jQuery
jquery.validate.js github地址 官方主页 doc demo jquery-validation-unobtrusive github地址 demo doc
- facebook api之Marketing API
General information on the Marketing APIs, access, versioning and more. The main use cases for the M ...
- 动态 hover 使用变相使用
使用 onmouseover 和 onmouseout 代替 hover foreach (var menu in Model.OrderBy(x => x.Order).Where(x ...
- SqlParameter 多个参数动态拼接解决参数化问题
多个参数化是固定比较easy,多个动态的就有点...工作中遇到的问题整理下来分享 ,上代码 SqlParameter[] param = new SqlParameter[] { }; List< ...
- 用Github做一个静态网页(GithubPages)
一.新建一个仓库(new). 二.命名Repository name为:(名字).github.io(一定要有.github.io). 三.勾选Initialize this repository w ...
- 同上篇 这篇是针对mesh的
资源加载性能测试代码 与上篇所提出的测试代码一样,我们对于其他资源的加载性能分析同样使用该测试代码.我们将每种资源均制作成一定大小的AssetBundle文件,并逐一通过以下代码在不同设备上进行加载, ...
- Codeforces Round #271 (Div. 2) E. Pillars 线段树优化dp
E. Pillars time limit per test 1 second memory limit per test 256 megabytes input standard input out ...
- springmvc源码解析(二)
架构流程: 1. 用户发送请求至前端控制器DispatcherServlet, 2. DispatcherServlet收到请求调用HandlerMapping处理器映射器. 处理器映射器根据请 ...
- dock容器操作命令
删除容器 docker rm -f ams 删除镜像 docker rmi -f ams:351 构建镜像 docker build -t ams:351 . 启动容器 docker run --p ...