I'm working on a similar thing and adding this line seems to help:
response.setHeader("Content-Disposition","attachment; filename=\"" +
myFileName+ "\";");



----- Original Message -----
From: "Gail Xiang" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, September 21, 2001 1:36 PM
Subject: Download Content using Struts action class


> Hi,
> I have a question about downloading files using Struts action class.
> The <a href> link for the Download is:
>
> <a
>
href="downloadContent.do?action=download&mimetype=<%=strMimeType%>&dir=<%=st
> rDir%>">Download</a>
>
> in which downloadContent.do is mapped to an action class.  It works
> fine functionally.
>
> However, when the "File Download" dialogue box is prompted, and the
> user selects "Save this file to disk", the default name given in the "File
> name" box in the next dialogue screen is "downloadContent.do" instead of
the
> file name.
>
> I tried to add /<%=filename%> after the "downloadContent.do" and was
> hoping the <%=filename%> would show up as the default file name.  This did
> not work since server does not know how to interpret
> downloadContent.do/<%=filename%>.
>
> One interesting observation is if directly uses a jsp page to handle
> the action, such as:
>
> <a
>
href="download.jsp/<%=filename%>?action=download&mimetype=<%=strMimeType%>&d
> ir=<%=strDir%>">Download</a>
>
> the <%=filename%> does show up as the default file name in the "save
> as" screen.  However, in my case I have to use an action class not a jsp
> because jsp does not work functionally although it could recognize the
file
> name on the other hand.
>
> Any hints would be appreciated!
>
> Thanks.
>
> -Gail

Reply via email to