Public String exceldomnload () throws exception {try {/* string Path = globalkeys. getfunctionconfig ("user_attach_save", "/opt/tmp/"); reguser Ru = (reguserlogininfo) request. getsession (). getattribute (globalkeys. reg_user_in_session_name )). getreguser (); string tmppath = file. separator + "import" + file. separator + Ru. getname () + file. separator; file targetfolder = new file (path, tmppath); // combine two channels by string fname = Request. getparameter ("fname"); */response. setcontenttype ("application/MSExcel;"); response. setheader ("content-disposition", new string ("attachment; filename =" + "error.xls "). getbytes ("gb2312"), "UTF-8"); file F = new file ("D:/20121211165820140_err.xls"); // file F = new file (targetfolder. getpath () + file. separator + fname); fileinputstream in = new fileinputstream (f); byte B [] = new byte [1024]; int I = 0; s Ervletoutputstream out = response. getoutputstream (); While (I = in. Read (B ))! =-1) {out. write (B, 0, I);} Out. flush (); out. close (); In. close ();} catch (exception e) {e. printstacktrace ();} return NULL ;}