说详细一点,就是服务器端同时产生了两个.xml文件,我要对它们进行数字签名,需要一块下到客户端,一开始想把那个下载对话框循环来解决,结果此路不同,请诸位帮忙,多谢

解决方案 »

  1.   

    <script>
    function DownURL(strRemoteURL,strLocalURL)
    {
    try
    {
    var xmlHTTP=new ActiveXObject("Microsoft.XMLHTTP");
    xmlHTTP.open("Get",strRemoteURL,false);
    xmlHTTP.send();
    var adodbStream=new ActiveXObject("ADODB.Stream");
    adodbStream.Type=1;//1=adTypeBinary
    adodbStream.Open();
    adodbStream.write(xmlHTTP.responseBody);
    adodbStream.SaveToFile(strLocalURL,2);
    adodbStream.Close();
    adodbStream=null;
    xmlHTTP=null;
    //OpenFile(strLocalURL);
    }
    catch(e)
    {
    window.confirm("下载URL出错!");
    }
    //window.confirm("下载完成.");
    }
    </script>
      

  2.   

    用Applet有可以
    public void ReadURL(String strURL)
    {
    try
    {
    int iHttpResult;
    URL m_URL=new URL(strURL);
    URLConnection m_URLConn=m_URL.openConnection();
    m_URLConn.connect();
    HttpURLConnection m_HttpConn=(HttpURLConnection)m_URLConn;
    iHttpResult=m_HttpConn.getResponseCode();
    if(iHttpResult!=HttpURLConnection.HTTP_OK)
    JOptionPane.showMessageDialog(this,"无法连接...");
    else
    {
    int iFileSize=m_URLConn.getContentLength();
    InputStreamReader m_Reader=new InputStreamReader(m_URLConn.getInputStream());
    char[] Buffer=new char[2048];
    int iNum=0;
    while(iNum>-1)
    {
    iNum=m_Reader.read(Buffer);
    if(iNum<0)break;
    //JOptionPane.showMessageDialog(this,new String(Buffer,0,iNum));
    }
    m_Reader.close();
    }
    }
    catch(Exception e)
    {
    JOptionPane.showMessageDialog(this,e.getMessage());
    }
    }