您的位置:首页 > 理论基础 > 计算机网络

Httpclient发送POST请求

2012-05-29 17:15 375 查看
public static void main(String[] args) throws HttpException, IOException {
HttpClient httpClient = new HttpClient();
PostMethod getMethod = new PostMethod(
"http://localhost:7070/notification.do?action=send");
getMethod.setParameter("title", "abc");
getMethod.setParameter("message", "2222");
getMethod.setParameter("username", "");
getMethod.setParameter("uri", "");
httpClient.executeMethod(getMethod);
System.out.println(getMethod.getResponseBodyAsString());
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  string