第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請及時(shí)綁定郵箱和手機(jī)立即綁定

代碼沒有報(bào)錯(cuò),但是點(diǎn)擊下載后,頁面上沒有彈出保存文件的對話框,使用火狐firebug調(diào)試,在返回的數(shù)據(jù)頁面右鍵“在新的標(biāo)簽頁中打開”,才會(huì)出來

55c706420001ede305000220.jpg

55c70643000119f705000254.jpg

//批量下載高鐵作業(yè)室的圖片,AJAX方式

@RequestMapping(params="method=downloadBoxImages")

public void downloadBoxImages(int id, HttpServletRequest req,HttpServletResponse resp) throws IOException{

List<BoxImages> bi = this.boxInfoService.getBoxImages(id);

resp.setContentType("application/x-msdownload");

resp.setHeader("Content-Disposition", "attachment;filename=pictures.zip");

String path = getServletcontext().getRealPath("/");

String rootpath = path.substring(0, (path.length()-4)) + "gjx_uploadfile\\";

int len = bi.size();

String[] filenames = new String[len];

for (int i = 0; i < len; i ++)

{

filenames[i] = bi.get(i).getImage_path();

}

String str = "";

String rt = "\r\n";

ZipOutputStream zos = new ZipOutputStream(resp.getOutputStream());

for(String filename : filenames){

str += filename + rt;

File file = new File(rootpath + filename);

zos.putNextEntry(new ZipEntry(filename));

FileInputStream fis = new FileInputStream(file);

byte b[] = new byte[1024];

int n = 0;

while((n = fis.read(b)) != -1){

zos.write(b, 0, n);

}

zos.flush();

fis.close();

}

zos.setComment("download success:" + rt + str);

zos.flush();

zos.close();

}


正在回答

3 回答

哈哈,代碼中關(guān)閉默認(rèn)打開方式就可以了

0 回復(fù) 有任何疑惑可以回復(fù)我~

前臺(tái)jsp頁面配action了嗎?

0 回復(fù) 有任何疑惑可以回復(fù)我~

放了半天沒人解決,自己解決了,給自己個(gè)好評(píng)吧

1 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

代碼沒有報(bào)錯(cuò),但是點(diǎn)擊下載后,頁面上沒有彈出保存文件的對話框,使用火狐firebug調(diào)試,在返回的數(shù)據(jù)頁面右鍵“在新的標(biāo)簽頁中打開”,才會(huì)出來

我要回答 關(guān)注問題
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)