JSP XML content-disposition

Discussion in 'Java' started by jsguru72, Apr 18, 2009.

  1. jsguru72

    jsguru72 Guest

    I am trying to have a jspx page return an excel attachment.

    I have it working with a plain jsp file using the following .

    <%@ page contentType="application/excel; charset=UTF-8" %>
    <%
    response.setHeader("Content-Disposition","attachment;
    filename=outfile.xls");
    %>
    <table>
    <tr><td>11</td><td>12</td><td>13</td></tr>
    <tr><td>21</td><td>22</td><td>23</td></tr>
    <tr><td>31</td><td>32</td><td>33</td></tr>
    </table>

    With the above, the output is sent as an excel file that can be saved
    or opened and everything works great. I am trying to convert this to
    an XML compliant jspx page.

    I used directive.page to set the content-type.
    <jsp:directive.page contentType="application/excel"
    pageEncoding="UTF-8"/>

    But I cannot find how to define the content-disposition without using
    the scriptlet. I really want to avoid the scriplets if possible.

    If anyone has any ideas or knows of any tutorials that might help, I
    would appreciate it.

    Thanks.
    jsguru72, Apr 18, 2009
    #1
    1. Advertising

  2. jsguru72

    Arne Vajhøj Guest

    jsguru72 wrote:
    > I am trying to have a jspx page return an excel attachment.
    >
    > I have it working with a plain jsp file using the following .
    >
    > <%@ page contentType="application/excel; charset=UTF-8" %>
    > <%
    > response.setHeader("Content-Disposition","attachment;
    > filename=outfile.xls");
    > %>
    > <table>
    > <tr><td>11</td><td>12</td><td>13</td></tr>
    > <tr><td>21</td><td>22</td><td>23</td></tr>
    > <tr><td>31</td><td>32</td><td>33</td></tr>
    > </table>
    >
    > With the above, the output is sent as an excel file that can be saved
    > or opened and everything works great. I am trying to convert this to
    > an XML compliant jspx page.
    >
    > I used directive.page to set the content-type.
    > <jsp:directive.page contentType="application/excel"
    > pageEncoding="UTF-8"/>
    >
    > But I cannot find how to define the content-disposition without using
    > the scriptlet. I really want to avoid the scriplets if possible.


    I don't think you can.

    Maybe a servlet would be better than a JSP page.

    Arne
    Arne Vajhøj, Apr 20, 2009
    #2
    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. Ramjee Tanguturi

    Content Disposition Problem with IE

    Ramjee Tanguturi, Nov 17, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    1,545
    Ramjee Tanguturi
    Nov 17, 2003
  2. S.Kartikeyan

    Response.AddHeader content-disposition

    S.Kartikeyan, Feb 6, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    3,948
    S.Kartikeyan
    Feb 6, 2004
  3. Martin Schmid

    Dynamic Content-Disposition file naming.

    Martin Schmid, May 7, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    508
    Martin Schmid
    May 7, 2004
  4. ben
    Replies:
    0
    Views:
    1,056
  5. =?Utf-8?B?R1JF?=
    Replies:
    1
    Views:
    3,394
    Craig Deelsnyder
    Aug 20, 2004
Loading...

Share This Page