Sorry... I haven't double-check before posting :-(

Seems you will have to write a servlet for that purpose..  (or are you using
something like struts?) 







> -----Message d'origine-----
> De : Balaji [mailto:[EMAIL PROTECTED] 
> Envoy� : vendredi, 10. d�cembre 2004 10:12
> � : POI Users List
> Objet : Re: Generating Excel From JSP
> 
> 
> hi,
> 
> I have tried this, I am getting exception :
> org.apache.jasper.JasperException: getOutputStream() has 
> already been called for this response
> 
> this is my code...i have tried...
> 
> <[EMAIL PROTECTED] import="java.io.File" %>
> <[EMAIL PROTECTED] import="org.apache.poi.poifs.filesystem.POIFSFileSystem"%>
> <[EMAIL PROTECTED] import="org.apache.poi.hssf.usermodel.*"%>
> <[EMAIL PROTECTED] import="org.apache.poi.hssf.model.Sheet"%>
> 
> <%
>         HSSFWorkbook book = new HSSFWorkbook();
>         HSSFSheet sheet = book.createSheet("Report");
>         HSSFRow row=null;
>         HSSFCell cell=null;
>         //
>         row = sheet.createRow((short)0);
>  //
>  cell = row.createCell((short)0);  cell.setCellValue("Customer");  //
>         row = sheet.createRow((short)i+1);
>         //
>         cell = row.createCell((short)0);
>         cell.setCellValue("TEST");
>         }
>         try
>         {
>         response.setContentType("application/octet-stream");
>         response.setHeader("Content-Disposition", 
> "attachment; filename=Report.xls");
>         book.write(response.getOutputStream());
>         }
>         catch(Exception e)
>         {
>  out.print("Exception while generating "+e);
>         }
>         %>
> 
> 
> ----- Original Message -----
> From: <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Friday, December 10, 2004 1:13 PM
> Subject: RE : Generating Excel From JSP
> 
> 
> Hi,
> 
> 
> Test.jsp 
> -------------------------------------------------------------------
> 
> <%@ page language="java" 
> import="java.io.*,org.apache.poi.hssf.usermodel.*,org.apache.p
oi.poifs.files
> ystem.*" %>
> <%
> // load a file or generate one...
> HSSFWorkbook wb = ...
> 
> // send it back to browser... 
> response.setContentType("application/octet-stream");
> response.setHeader("Content-Disposition", "attachment; 
> filename=monk.xls"); wb.write(response.getOutputStream());
> %>
> 
> --------------------------------------------------------------
> --------------
> 
> Hope it helps :-)
> 
> 
> Regards,
> 
> dreier
> 
> 
> 
> > -----Message d'origine-----
> > De : Balaji [mailto:[EMAIL PROTECTED]
> > Envoy� : vendredi, 10. d�cembre 2004 08:00
> > � : POI Users List
> > Objet : Re: Generating Excel From JSP
> >
> >
> > Hi there friends,
> >
> > I have generated excel from JSP with POI API, am using Tomcat 
> > webserver, created a temporary(temp) folder in Tomcat root 
> folder, if 
> > user likes to export to excel, JSP generates the excel and 
> put it into 
> > the temporary folder, then user will get the URL to download as
> > "http://localhost/temp/filename.xls"; , is my > approach is
> > correct?? or anyother approach to save directly in the client
> > machine rather saving in Server as a temporary file...
> >
> > pls help me...its very urgent...
> >
> > Thanks and Regards,
> >
> > Venkatesh Balaji R.,
> >
> >
> >
> >
> >
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to