我有,QQ:12318872
MAIL:[email protected]

解决方案 »

  1.   

    我有,QQ:12318872
    mail:[email protected]
      

  2.   

    package communication;import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;import javax.swing.*;
    import java.util.*;
    import java.io.*;
    import java.net.*;
    import javax.swing.text.*;
    import java.net.URL;public class Applet1 extends Applet {
      boolean isStandalone = false;  URL url;
      String uri = "init";
      String servletAddress = "init";
      String urlS = "init";
      String uriS ="init";
      String sqlAptToSvl="";
      /**Get a parameter value*/
      public String getParameter(String key, String def) {
        return isStandalone ? System.getProperty(key, def) :
          (getParameter(key) != null ? getParameter(key) : def);
      }  /**Initialize the applet*/
      public void init() {
          try {
          jbInit();
          readCfgByParameter() ;
    connectServlet(servletAddress);
        }
        catch(Exception e) {
          e.printStackTrace();
        }
      }
      /**Component initialization*/
      private void jbInit() throws Exception {
      }
      /**Get Applet information*/
      public String getAppletInfo() {
        return "Applet Information";
      }
      /**Get parameter info*/
      public String[][] getParameterInfo() {
        return null;
      }  public void connectServlet(String  s){
      if (s.length() == 0){
      return;
      }
      try{
      java.net.URL url = new java.net.URL (s);
      java.net.URLConnection  con = url.openConnection() ;  //intialize the connection
      con.setUseCaches(false) ;
      con.setDoOutput(true) ;
      con.setDoInput(true) ;   ObjectInputStream in = new ObjectInputStream(con.getInputStream() );
      //read the data
       sqlAptToSvl = in.readUTF();
       URL myURL=new URL(getCodeBase(),sqlAptToSvl);
       in.close();
       Object o=myURL.getContent();System.out.println(sqlAptToSvl);
         }
                 catch (Exception e){              e.printStackTrace();
                  return;
                }  }   public String readCfgByParameter() { byte buffer[] = new byte[2056]; try {      InputStream fileIn= new FileInputStream("conSer.cfg");
          int bytes = fileIn.read(buffer, 0, 2056);      String strFile = new String(buffer, 0, bytes, "Default");
          servletAddress = strFile;
          System.out.println(strFile) ;
               return   servletAddress; }catch(Exception e){
                        return "Read config file failed!";
    }  }  }