关于HttpURLConnection中的POST? 用xmlhttp,你网上查,有很多资料 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 在Java环境里,用java.net就很棒了。xmlhttp是微软东西,不能跨平台,而且是本地activex代码,调起来麻烦。 可是用java.net怎么实现啊...?等ing.. public void GetwayPostxml(String xmllir)throws Exception { url = new URL(rc.getgateway_host()+":"+rc.getgateway_port() ); HttpURLConnection connection = (HttpURLConnection) url.openConnection() ; connection.setRequestMethod("POST"); connection.setDoOutput(true); PrintWriter out = new PrintWriter(connection.getOutputStream()); // send the encoded message out.println(URLEncoder.encode(xmllir, "UTF-8")); out.close();// System.out.println(xmllir); if(connection.getResponseCode()!=200) System.out .println(connection.getResponseCode()+connection.getResponseMessage() ); BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); String line; FileWriter fr = new FileWriter("TEMP/ll.XML"); BufferedWriter bfr = new BufferedWriter(fr); while ((line = in.readLine()) != null) { bfr.write(line); } bfr.close() ; File fi = new File("TEMP/ll.XML"); liap.saxDoc(this.conn ,fi, System.out ); in.close(); }这是我的实现类,帮忙看一下了... thread dump 代码求指点 更改想部署位置 一个关于小数位数截取的简单问题 帮我看一下这代码有什么问题? FileinputSream 的问题 怎么将文件反着读? 列表读取的一个简单问题。请教 寻书:《java2实用教程》! 请教高手:如何实现一个java程序,该程序具备光盘自启动功能,所有需要的jdk包都在光盘上,在机器上不安装jdk,不知道如何实现,是否只能 谁有j++builder4.0的序列号啊? 下面的代码存在问题,请指出。(javascript) MYSQL FOR JDBC DRIVER的安装问题!
xmlhttp是微软东西,不能跨平台,而且是本地activex代码,调起来麻烦。
connection.setRequestMethod("POST");
connection.setDoOutput(true);
PrintWriter out = new PrintWriter(connection.getOutputStream()); // send the encoded message
out.println(URLEncoder.encode(xmllir, "UTF-8"));
out.close();
// System.out.println(xmllir);
if(connection.getResponseCode()!=200)
System.out .println(connection.getResponseCode()+connection.getResponseMessage() ); BufferedReader in
= new BufferedReader(new InputStreamReader(connection.getInputStream()));
String line;
FileWriter fr = new FileWriter("TEMP/ll.XML");
BufferedWriter bfr = new BufferedWriter(fr);
while ((line = in.readLine()) != null) {
bfr.write(line);
}
bfr.close() ;
File fi = new File("TEMP/ll.XML");
liap.saxDoc(this.conn ,fi, System.out );
in.close();
}这是我的实现类,帮忙看一下了...