RELATEED CONSULTING
相关咨询
选择下列产品马上在线沟通
服务时间:8:30-17:00
你可能遇到了下面的问题
关闭右侧工具栏

新闻中心

这里有您想知道的互联网营销解决方案
通过springboot写post请求

使用工具类

     
            cn.hutool
            hutool-all
            4.3.2
        

编写请求类

@Controller
public class UploadController {

    @RequestMapping("/{page}")
    public String showPage(@PathVariable String page) {
        return page;
    }

    @GetMapping("/posthttp")
    public String postparam(String param,Model model) {
        if (param.equals("")) {
            Person single = new Person("aa", 11);
            model.addAttribute("singlePerson", single);
            model.addAttribute("postcontent", "URL没有数据");
            return "person";
        } else {
            Person single = new Person("aa", 11);
            model.addAttribute("singlePerson", single);
//        System.out.println("这是提交的参数:"+param);
            HttpRequest httpRequest = HttpRequest.get(param);
            HttpResponse execute = httpRequest.execute();
//        System.out.println("这是结果"+execute.body());
            model.addAttribute("postcontent", execute.toString());
            return "person";
        }

响应

通过springboot写post请求

成都创新互联公司专业为企业提供昂昂溪网站建设、昂昂溪做网站、昂昂溪网站设计、昂昂溪网站制作等企业网站建设、网页设计与制作、昂昂溪企业网站模板建站服务,十余年昂昂溪做网站经验,不只是建网站,更提供有价值的思路和整体网络服务。

通过springboot写post请求


网站题目:通过springboot写post请求
当前链接:http://cqwzjz.cn/article/jsooje.html