用jsp打开word,写法如下:
点击链接调用该页面,弹出提示窗,打开or下载,选打开,然后word并没有打开文档,而是要求选择编码方式,windows默认 或者其他编码,但经过试验,基本都不能正常打开,而是打开了一堆乱码。
我这里,问题出在这句话:response.setHeader("Content-disposition","inline; filename=mc.doc");
将里面的"inline" 换成:attachment,
即: response.setHeader("Content-disposition","attachment; filename=mc.doc");
问题解决,不会出现编码选择的提示框,正常打开word。