JAVA携带参数(带有参数)直接发送POST请求
2021-04-17 16:27
标签:urlencode value sys int close enc java mes trace JAVA携带参数(带有参数)直接发送POST请求 标签:urlencode value sys int close enc java mes trace 原文地址:https://www.cnblogs.com/pxblog/p/13299642.htmlpackage com.test;
import org.apache.http.HttpEntity;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import java.util.ArrayList;
import java.util.List;
public class Test {
public static void main(String[] args) {
sendPost();
}
public static void sendPost(){
String value="12222";
//创建post请求对象
HttpPost post = new HttpPost("http://localhost:8080/test.jspx");
try {
//创建参数集合
List
文章标题:JAVA携带参数(带有参数)直接发送POST请求
文章链接:http://soscw.com/index.php/essay/76092.html