Viewing Excel files using JSP

Discussion in 'Java' started by BenJose, Nov 20, 2004.

  1. BenJose

    BenJose Guest

    Iam using a simple webpage to view/download excel files. But for some
    reason I use the <a href> tag to point to the excel file and it shows
    up garbled. I tried altering the content type and also did some tweaks
    but nothing works... Any pointers in this regards ??

    Iam using a Apache Tomcat server.

    This is the script itself:
    <html>

    <head>

    <meta http-equiv="Content-Language"
    content="application/vnd.ms-excel">
    <meta http-equiv="Content-Type" content="application/vnd.ms-excel;
    charset=windows-1252">

    <title>Maine Educational Assessment</title>
    <style type="text/css">
    <!--
    ..style1 {font-size: 10px}
    -->
    </style>

    <!-- End of: /portal/sliverheader/sliverhead.html -->

    </head>
    <body marginheight="0" marginwidth="0">

    <a href="tst.xls">Excel Tst</a>

    </body>

    </html>

    -Ben
     
    BenJose, Nov 20, 2004
    #1
    1. Advertising

  2. BenJose

    Tony Morris Guest

    "BenJose" <> wrote in message
    news:...
    > Iam using a simple webpage to view/download excel files. But for some
    > reason I use the <a href> tag to point to the excel file and it shows
    > up garbled. I tried altering the content type and also did some tweaks
    > but nothing works... Any pointers in this regards ??
    >
    > Iam using a Apache Tomcat server.
    >
    > This is the script itself:
    > <html>
    >
    > <head>
    >
    > <meta http-equiv="Content-Language"
    > content="application/vnd.ms-excel">
    > <meta http-equiv="Content-Type" content="application/vnd.ms-excel;
    > charset=windows-1252">
    >
    > <title>Maine Educational Assessment</title>
    > <style type="text/css">
    > <!--
    > .style1 {font-size: 10px}
    > -->
    > </style>
    >
    > <!-- End of: /portal/sliverheader/sliverhead.html -->
    >
    > </head>
    > <body marginheight="0" marginwidth="0">
    >
    > <a href="tst.xls">Excel Tst</a>
    >
    > </body>
    >
    > </html>
    >
    > -Ben


    Which has what to do with Java?

    --
    Tony Morris
    http://xdweb.net/~dibblego/
     
    Tony Morris, Nov 20, 2004
    #2
    1. Advertising

  3. BenJose

    shakah Guest

    You probably have to add Excel to Tomcat's MIME types in order for it
    to send the correct response header.

    I think you just have to add the following to the webapp's web.xml (as
    a child of the web-app tag):

    <mime-mapping>
    <extension>xls</extension>
    <mime-type>application/msexcel</mime-type>
    </mime-mapping>
     
    shakah, Nov 20, 2004
    #3
  4. BenJose

    Kaushiksaha05

    Joined:
    May 20, 2010
    Messages:
    1
    shakah,

    Thank you .It's work....in Bea Weblogic server also....Thank you very much....
     
    Kaushiksaha05, May 20, 2010
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    1,131
  2. Replies:
    0
    Views:
    4,391
  3. Toby Newman
    Replies:
    13
    Views:
    1,142
    Andrzej Adam Filip
    Jan 29, 2007
  4. =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?=

    Problem with Excel reports ::::Excel 2003 Migration To Excel 2007

    =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?=, Oct 5, 2007, in forum: ASP .Net
    Replies:
    15
    Views:
    1,511
    =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?=
    Oct 24, 2007
  5. Replies:
    4
    Views:
    610
    Dr John Stockton
    Jun 3, 2006
Loading...

Share This Page