下载问题 说详细一点,就是服务器端同时产生了两个.xml文件,我要对它们进行数字签名,需要一块下到客户端,一开始想把那个下载对话框循环来解决,结果此路不同,请诸位帮忙,多谢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <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> 用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()); } } 在线等,急人!为啥我用merge或persist方法总是新增记录呢 DOM4J解析XML 学习jsp比较经典的书? 高手请进 谁能给份梅花雪的树型控件? struts下关于特殊字符不能正常化显示问题!!! 会计系统问题 STRUCTS中为何找到了我的action类确无法调用,结果跳转到一个空页面?(100分求助`~`~~) Jsp分割字串并放入数组的问题 一个heibernate的问题(欢迎对heibernate的感兴趣的朋友们进来讨论) 一个简单问题关于JSP的~~~~~~~~~~~~~急 怎么测试servlet文件?
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>
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());
}
}