You can to do this:

response.setContentType("application/vnd.ms-excel;
charset=iso-8858-1");
out.println("<html>");
out.println("<table>");
out.println("<tr>");
out.println("<td>mycell-1</td>");
out.println("<td>mycell-2</td>");
out.println("<td>mycell-3</td>");
out.println("</tr>");
out.println("</table>");
out.println("</html>");

 --- Balaji <[EMAIL PROTECTED]> escreveu: 
> Hi,
> 
> Is there anyother way to generate Excel through JSP.
> Other than saving in
> server side......
> 
> 
> kindly help me out buddies..........
> 
> 
> 
> ----- Original Message -----
> From: <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, December 10, 2004 3:14 PM
> Subject: RE : Generating Excel From JSP
> 
> 
> 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]
> 
> 
> 
=== message truncated === 

=====
------------------------------------------------------- 
Felipe F. Palma Dias 
http://geocities.yahoo.com.br/palmadias/


        
        
                
_______________________________________________________ 
Yahoo! Mail - Agora com 250MB de espa�o gratuito. Abra 
uma conta agora! http://br.info.mail.yahoo.com/

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

Reply via email to