Hi ,
I have a controller which returns an excel view as follows. Problem is when I access the controller it says 'File Error :data may been lost'. I must be doing something silly here. Please help !!
The above is the code inside my controller...
I have a controller which returns an excel view as follows. Problem is when I access the controller it says 'File Error :data may been lost'. I must be doing something silly here. Please help !!
public ModelAndView handleRequest(HttpServletRequest request,
HttpServletResponse respone) throws Exception {
return new ModelAndView(new ExcelTemplateView());
}
public class ExcelTemplateView extends AbstractExcelView
{
@Override
protected void buildExcelDocument(Map map, HSSFWorkbook wb,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
InputStream inStream = null;
try
{
ClassPathResource resource = new
ClassPathResource("GUITemplateForExcelUpload.xls") ;
wb = new HSSFWorkbook(resource.getInputStream(),true);
}
catch(IOException io)
catch(Exception io)
{
logger.error("Errorwhile trying to open the template file ",io);
}
finally
{
if(inStream != null)
{
//inStream.close();
}
}
}
HttpServletResponse respone) throws Exception {
return new ModelAndView(new ExcelTemplateView());
}
public class ExcelTemplateView extends AbstractExcelView
{
@Override
protected void buildExcelDocument(Map map, HSSFWorkbook wb,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
InputStream inStream = null;
try
{
ClassPathResource resource = new
ClassPathResource("GUITemplateForExcelUpload.xls") ;
wb = new HSSFWorkbook(resource.getInputStream(),true);
}
catch(IOException io)
catch(Exception io)
{
logger.error("Errorwhile trying to open the template file ",io);
}
finally
{
if(inStream != null)
{
//inStream.close();
}
}
}
Comment