Hi ,
Now I can open the excel file by ie , but I found it will not pop-up a
new page to display the result(actually it use the currently page , so
the previous information on the page was lost), am I missing
something?
<code>
response.setHeader("Expires", "0");
response.setHeader("Cache-Control", "must-revalidate,
post-check=0,pre-check=0");
response.setHeader("Pragma", "public");
response.setHeader("Content-disposition", "inline;
filename=ExportTempFile.xls");
// setting the content type
response.setContentType("application/vnd.ms-excel");
ServletOutputStream out = response.getOutputStream();
byte[] buffer = new byte[BUFFER_SIZE];
ByteArrayOutputStream baos = new
ByteArrayOutputStream();
int length = inputStream.read(buffer);
while(length != -1) {
baos.write(buffer);
length = inputStream.read(buffer);
}
baos.writeTo(out);
baos.close();
out.close();
</code>
in web.xml
add the following
<mime-mapping>
<extension>xls</extension>
<mime-type>application/msexcel</mime-type>
</mime-mapping>