Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Java SE 综合讨论区  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 ~关于模拟post method传送数据至asp page的问题
alexlex





发贴: 17
积分: 0
于 2004-10-12 15:57 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
asp page url见代码
使用ie打开,输入错误信息会出现下列出错信息

*** This MemberID cannot be found ***

如果在url里直接加参数传过去,返回页面是无错误信息的

用如下代码,得到的html里面却不含出错信息,怀疑是否没能正确模拟
但是使用本机的tomcat作试验,这个方法可以post数据到jsp/servlet

老板交给我的任务,大家表鄙视我~.~


try {
      
      String urlstr = "http://www.gamenz.com/Membership/Member_Log_in.asp";
      String query = "MemberID=test&Password=test";

      URL url = new URL(urlstr);
      URLConnection uc = url.openConnection();

      uc.setDoOutput(true);
      PrintStream out = new PrintStream(uc.getOutputStream());
      out.println(query);
      out.close();

      DataInputStream in = new DataInputStream(uc.getInputStream());
      String line;
      while ((line = in.readLine()) != null) {
        System.out.println(line);
      }
    } catch (MalformedURLException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }




话题树型展开
人气 标题 作者 字数 发贴时间
3534 ~关于模拟post method传送数据至asp page的问题 alexlex 1498 2004-10-12 15:57
2636 Re:~关于模拟post method传送数据至asp page的问题 floater 230 2004-10-12 22:08

flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923