当前位置:首页
开发技术指南» 文章正文
    引言:

    摘要: 做了一个程序,其中有个登陆模块 在点击登陆button后我的代码是 passworddlg.close; form1.showmodal; 运行一切正常,但是在关闭整个程序的时候出错,abstract error. 如果改为 form1.showmodal; passworddlg.close; 程序运行正常,但是passworddlg并没有真正关闭,而只是隐藏起来了,拖开主窗体form1......
    摘要: 现在我在一个页上放了三个按钮,各有不同的click事件,可我不论点哪一个都只执行一个事件,我检查了窗体设机器,事件总是绑不上,怎么办? ......


如何控制客户端浏览器打开文件另存为对话框

如何控制客户端浏览器打开文件另存为对话框?    
  用户要定制下载数据库中的数据,用户提交定制条件,后台再数据库中进行查询,然后再服务器上生成文件,不把文件地址给用户显示出来,也不让用户再做操作,用户提交了定制条件后,后台操作完后就直接再客户端打开文件另存为对话框,怎么做?    
 

NO.1   作者: losen

eg:已打开excel为例  
   
          //访问数据库,获得需要下载的文件,eg:   0508.xls  
                            String   filenameForSave   =   "abc.xls";  
           
                            //指定使用excel打开  
          response.setContentType("application/msexcel");  
                            //filename为文件打开时,你希望它显示的title  
          response.setHeader("Content-disposition","attachment;filename=abc.xls");  
   
          BufferedInputStream   bufferInput   =   null;  
          BufferedOutputStream   bufferOutput   =   null;  
           
          try   {  
                                    //upload为工程下的一个文件夹  
                  bufferInput   =   new   BufferedInputStream(new   FileInputStream(servlet.getServletContext().getRealPath("upload\\"   +   filenameForSave)));  
                  bufferOutput   =   new   BufferedOutputStream(response.getOutputStream());  
   
                  byte[]   buff   =   new   byte[2048];  
                  int   bytesRead;  
   
                  while   (-1   !=   (bytesRead   =   bufferInput.read(buff,   0,   buff.length)))   {  
                  bufferOutput.write(buff,0,bytesRead);  
                  }  
   
          }   catch(final   IOException   e)   {  
          e.printStackTrace();  
          forward   =   mapping.findForward("error");  
           
          }   finally   {  
                  if   (bufferInput   !=   null)  
                  bufferInput.close();  
                  if   (bufferOutput   !=   null)  
                  bufferOutput.close();  
   
          }


 ·时间格式做条件查询怎么写    »显示摘要«
    摘要: 我下面的语句哪里出错了 想问一下用时间做判断条件该怎么写呢 enddate 是时间类型 select * from mem_db where enddate>2006-9-4 12:12:27 order by mem_id desc 请各位高手指教 ......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE