JSP XML content-disposition

J

jsguru72

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.
 
A

Arne Vajhøj

jsguru72 said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,015
Latest member
AmbrosePal

Latest Threads

Top