gpt4 book ai didi

java - 重定向用户和 POST 参数

转载 作者:行者123 更新时间:2023-12-02 04:26:46 31 4
gpt4 key购买 nike

我想在页面打开和 POST 参数时重定向用户。我试过这个:

@PostMapping(value = "/redirect/{token}"})
public ModelAndView handleRedirectMessage(@PathVariable("token") String token,
@RequestBody Transaction transaction, HttpServletRequest request) throws Exception {

String post_param = "some_payload";
return new ModelAndView("redirect:" + url);
}

是否可以重定向用户并发布一些参数?

最佳答案

例如,您有

@GetMapping("/sample_request_mapping_path")
public ModelAndView something() {
//...
}

修改为

@PostMapping(value = "/foo"})
public ModelAndView handleRedirectMessage(@PathVariable("token") String token, @RequestBody Transaction transaction, HttpServletRequest request) throws Exception {
String post_param = "some_payload";
return "redirect:/sample_request_mapping_path";
}

关于java - 重定向用户和 POST 参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56605475/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com