关于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(); }这是我的实现类,帮忙看一下了... 看了好多帖子说J2SE学完后学J2EE,想知道大家说的J2EE具体是什么? 键盘事件监听 日期的国际化--只显示年月 jsp数据库编程问题 请问如何得知调用栈? 大侠/高人/精英/坛主请进/新手:我想知道用Java Applet能不能做类似于外汇排价功能.实时显示数据库中的数据我是用b/s做的 Thank You 基础问题 请问哪里可以下载J2SDK1.4.0和Tomcat 4.0?……急用!! jTextField的focus 一个类数组的问题? 下面的代码存在问题,请指出。(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();
}这是我的实现类,帮忙看一下了...