Check out http://wotsit.org/.


>From: Alvin Lau <[EMAIL PROTECTED]>
>Reply-To: "A mailing list for discussion about Sun Microsystem's Java
>        Servlet API Technology." <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: Re: servlet using Excel example code
>Date: Thu, 6 Apr 2000 16:36:08 +0200
>
>How about if i want to make the report look a bit better by adding some
>colors. Is there any place that i can find the file format of excel?
>
>-----Original Message-----
>From: A mailing list for discussion about Sun Microsystem's Java Servlet
>API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of Ryan
>Richards
>Sent: Thursday, April 06, 2000 4:09 PM
>To: [EMAIL PROTECTED]
>Subject: Re: servlet using Excel example code
>
>
>Mani,
>
>First: On your application server or web server make SURE you have excel
>set
>up in the MIME types. THis way the server knows what to do with this
>contentType. This may be your problem.
>
>re:  res.setContentType("application/vnd.ms-excel");
>
>This just sets the content type of the data to be returned to the client to
>be excel formatted. This is exactly what you would see in the MIME types on
>the web server ->  application/vnd.ms-excel and identify .csv .xls for the
>file extensions.
>
>the setContentType works the same with outputting HTML information. for
>example:
>
>res.setContentType("text/html");
>out.println("<BLINK>Blinking Text</BLINK>"); would then display an actual
>blinking text line using the HTML tags.
>
>Let me know if you need anymore help.
>Ryan
>
>
>
>
>------Original Message------
>From: Nagamani Nutulapati <[EMAIL PROTECTED]>
>To: Ryan Richards <[EMAIL PROTECTED]>
>Sent: April 6, 2000 7:44:20 AM GMT
>Subject: RE: servlet using Excel example code
>
>
>Richards,
>
>Though new to the topic, I just tried out the example given by you. I'm
>using IE. The servlet generates the output on to the browser but not to an
>excel sheet.
>
>Also, could u please be elaborate on
>
>  res.setContentType("application/vnd.ms-excel");
>
>Thanks,
>Mani
>
>-----Original Message-----
>From: Ryan Richards [ mailto:[EMAIL PROTECTED]
><mailto:[EMAIL PROTECTED]> ]
>Sent: Wednesday, April 05, 2000 10:18 PM
>To: [EMAIL PROTECTED]
>Subject: servlet using Excel example code
>
>
>OK guys, here a little servlet I wrote to place a query returned from a
>database into an excel spreadsheet. I modified the code to make it simpler,
>hopefully I didnt make any mistakes in editing. Feel free to email me if
>you
>have any questions.
>
>If you are using Netscape it prompts you to open or save. If you open the
>Excel is laucnhed and your spreadsheet contains the data. If you are using
>IE then it automatically opens an excel spreadsheet.
>
>HTH
>Ryan
>--------------------------------------------------------
>import java.sql.*;
>import java.io.*;
>import javax.servlet.*;
>import javax.servlet.http.*;
>import java.util.StringTokenizer;
>
>public class dbServlet extends HttpServlet
>                                     implements SingleThreadModel {
>   Connection conn = null;
>
>   public void init( ServletConfig config ) throws ServletException {
>     super.init(config);
>     ...
>     ...
>     snip
>   } // init
>
>   public void doGet( HttpServletRequest req,
>                       HttpServletResponse res )
>     throws ServletException, IOException {
>
>         // Setup the stream
>         PrintWriter out = res.getWriter();
>         res.setContentType("application/vnd.ms-excel");
>
>     try { // Create a Statement
>        Statement stmt = conn.createStatement ();
>        ResultSet rset = null;
>
>        rset = stmt.executeQuery(
>                         "select name,"+
>                         "salary,"+
>                         "dept,"+
>                         "from employee_table"+
>                 //
>                 // Send the information to Excel.
>                 // The tabs (\t) tell the code to place
>                 // each rset item into it's own column.
>                 //
>
>                 out.println("Name\tSalary\tDept");
>                 while ( rset.next () )
>                 {
>                 out.println(rset.getString(1)+"\t"+
>                             rset.getString(2)+"\t"+
>                             rset.getString(3));
>                 }
>
>     } catch ( SQLException e ) {
>        System.err.println("A database error occurred.");
>     }
>         out.close();
>   } // doGet
>} // dbServlet
>
>Ryan Richards
>Technical Consultant
>Database Consultants, Inc.
>Oklahoma City, OK
>-----------------------------------------------
>FREE! The World's Best Email Address @email.com
>Reserve your name now at http://www.email.com <http://www.email.com>
>
>___________________________________________________________________________
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff SERVLET-INTEREST".
>
>Archives: http://archives.java.sun.com/archives/servlet-interest.html
><http://archives.java.sun.com/archives/servlet-interest.html>
>Resources: http://java.sun.com/products/servlet/external-resources.html
><http://java.sun.com/products/servlet/external-resources.html>
>LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
><http://www.lsoft.com/manuals/user/user.html>
>
>Ryan Richards
>Technical Consultant
>Database Consultants, Inc.
>Oklahoma City, OK
>-----------------------------------------------
>FREE! The World's Best Email Address @email.com
>Reserve your name now at http://www.email.com
>
>___________________________________________________________________________
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff SERVLET-INTEREST".
>
>Archives: http://archives.java.sun.com/archives/servlet-interest.html
>Resources: http://java.sun.com/products/servlet/external-resources.html
>LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
>___________________________________________________________________________
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff SERVLET-INTEREST".
>
>Archives: http://archives.java.sun.com/archives/servlet-interest.html
>Resources: http://java.sun.com/products/servlet/external-resources.html
>LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to