HI I do something similiar where I offer the ability for the user
to download a html report down to disk.

The simplified code looks like as the following:
( Note: I am using JavaBeans to produce the actual data)
The content type is where you specify the mime type you want the browser to
handle. IN this case I make up my own, since that forces the browser to open
a save file request. If you were to change it to a different mime type like
excel (which will vary from machine to machine depending on the version of
excel you have installed, on my machine its application/x-msexcel ) the
browser will change its behavior accordingly
Of course each browser type will handle it differently depending on
configuration and browser species)

<%@ page buffer="256k"
         autoFlush="true"
         import="Felix.*"
         contentType="application/x-ack download"
%>

<%      // clear all output to client browser.
        out.clear();

        // Get my report and process it
        Web_Report DownloadBean = new
Web_Report(request.getParameter("hd_storedprocedure"));
        Jsp_Html   lbean_html   = new Jsp_Html();
        DownloadBean = lbean_html.downloadReport(DownloadBean);

        //write to the output buffer the report contents in HTML format
        out.println(DownloadBean.getReportHTML());

%>

Hope this helps
Casey
[EMAIL PROTECTED]
www.jspinsider.com

>From: hua ge <[EMAIL PROTECTED]>
>Reply-To: A mailing list about Java Server Pages specification and
>     reference <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: question regarding MIME type
>Date: Fri, 8 Sep 2000 21:41:43 GMT
>
>Hi,All
>I have a scenario in my project: there will be a search result page , it's
>layout should be like this:
>
>
>=====================================================
>Name     SS#        phone        address
>
>name1    ss1        phone1       address1
>name2    ss2        phone2       address2
>
>
>                download button here
>                ( Text Tab delimited *.txt
>                 or CSV Comma delimited *.csv)
>
>=====================================================
>
>when this page is generated, we will NOT write those data to a file on the
>server(we don't want create file to the server). so the download button
>here
>is actually not downloading file from server.
>
>Is there better way that user can download a file with the search result as
>content ?
>
>could it possible by setContentType with some special valid MIME type to
>invoke excel or word window with the data showing there? if so, how to?
>
>any one has experience with that?
>and where I can get the documentation on the valid MIME types because I
>only
>know couple MIME type such as text/html, text/plain,
>application/x-filler...
>
>
>thanks a lot.
>
>Helen
>
>
>
>
>
>
>
>
>_________________________________________________________________________
>Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
>
>Share information about yourself, create your own public profile at
>http://profiles.msn.com.
>
>===========================================================================
>To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
>JSP-INTEREST".
>Some relevant FAQs on JSP/Servlets can be found at:
>
>http://java.sun.com/products/jsp/faq.html
>http://www.esperanto.org.nz/jsp/jspfaq.html
>http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Share information about yourself, create your own public profile at
http://profiles.msn.com.

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to