报错:Source not found for ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 258
源码:
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doPost(request,response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
try{
response.setContentType("application/vnd.ms-excel;charset=utf-8");
response.setHeader("Content-Disposition", "attachment;filename="
+ new String("测试.xls".getBytes(), "iso-8859-1"));
ServletOutputStream out = response.getOutputStream();
BufferedInputStream bis = null;
BufferedOutputStream bos = null;
try {
bis = new BufferedInputStream(this.getInputStream());
bos = new BufferedOutputStream(out);
byte[] buff = new byte[2048];
int bytesRead;
while (-1 != (bytesRead = bis.read(buff, 0, buff.length))) {
bos.write(buff, 0, bytesRead);
}
} catch (final IOException e) {
System.out.println("IOException.");
throw e;
} finally {
if (bis != null)
bis.close();
if (bos != null)
bos.close();
}
}catch(Exception e){
e.printStackTrace();
}
}
private InputStream getInputStream() {
[color=red]//运行下面那一行就报错[/color]
[color=red] HSSFWorkbook wb = new HSSFWorkbook();[/color]
HSSFSheet sheet = wb.createSheet("sheet1");
HSSFRow row = sheet.createRow(0);
HSSFCell cell = row.createCell((short) 0);
cell.setCellValue("序号");
cell = row.createCell((short) 1);
cell.setCellValue("姓");
cell = row.createCell((short) 2);
cell.setCellValue("名");
cell = row.createCell((short) 3);
cell.setCellValue("年龄");
//创建一行记录
row = sheet.createRow(1);
cell = row.createCell((short) 0);
cell.setCellValue("1");
cell = row.createCell((short) 1);
cell.setCellValue("刘");
cell = row.createCell((short) 2);
cell.setCellValue("继忠");
cell = row.createCell((short) 3);
cell.setCellValue("25");
ByteArrayOutputStream os = new ByteArrayOutputStream();
try {
wb.write(os);
} catch (IOException e) {
e.printStackTrace();
}
byte[] content = os.toByteArray();
InputStream is = new ByteArrayInputStream(content);
return is;
}