没必要用Applet啊,这种用Servlet更好啊
用Applet的话应该用URL类连接幷把查询字符串提交,然后接收InputStream,比如:
URL u = new URL("http://somesearchsite.org/cgi-bin/search?" + query);
InputStream in = new BufferedInputStream(u.openStream());
int c;
while((c = in.read()) != -1)
 System.out.print((char)c);

解决方案 »

  1.   

    POST数据是可以的,不过APPLET只能连服务器一个主机,连其他的主机的话要签名。
      

  2.   

    URLConnection urlconnection = (new URL("http://somesearchsite.org/cgi-bin/search")).openConnection();
                urlconnection.setDoOutput(true);
                PrintWriter printwriter = new PrintWriter(urlconnection.getOutputStream());
                printwriter.print("hello");
                printwriter.close();
    然后就是读URL了,请参考我的一个抓网页代码的方法:
    public String getWebPage(String url) throws Exception
      {
        try
        { StringBuffer buf=new StringBuffer(10000);
          java.net.URL u=new URL(url);
          InputStream is=u.openStream();
          java.io.DataInputStream dis=new DataInputStream(is);
          int read_count=0;
          byte[] byte_buf=new byte[1024];      while(read_count>-1)
             {
              read_count = dis.read(byte_buf);
              if(read_count>0)
              buf.append(new String(byte_buf, 0, read_count));
            }      return buf.toString();
        }
        catch(Exception e) {throw e;}
      }