Although Chris's solution works, I've always been partial to setting content-disposition to attachment.
I can't tell you off the top of my head the struts-y way to do it, but this is what it's meant for. -Wes On Mon, 2008-07-07 at 11:31 -0700, Chris Pratt wrote: > One way is to set the content type of the downloaded item to something > the browser doesn't know how to handle itself, like > application/octet-stream > (*Chris*) > > On Mon, Jul 7, 2008 at 10:21 AM, Struts Two <[EMAIL PROTECTED]> wrote: > > I have an action class that downloads a file from db2 database. However; > > when the download occurs, the file is displayed in the browser. I would > > like to have the user prompted with the save/open dialog. I was wondering > > what I am missing here. Below are my configuration and action class for the > > file download: > > <action name="ticketFileDownload" > > class="ccol.action.ticket.TicketFileDownload"> > > <result name="success" type="stream"> > > <param name="contentType">application/octet-stream</param> > > </result> > > </action> > > public class TicketFileDownload extends ActionSupport { > > @EJB3Local > > TicketLocal ticketLocal; > > private long attachmentId; > > > > private InputStream inputStream; > > public long getAttachmentId() { > > return attachmentId; > > } > > public void setAttachmentId(long attachmentId) { > > this.attachmentId = attachmentId; > > } > > public void setInputStream(InputStream inputStream) { > > this.inputStream = inputStream; > > } > > > > public InputStream getInputStream() { > > return inputStream; > > } > > > > public String execute(){ > > Attachment attachment = ticketLocal.findAttachment(getAttachmentId()); > > setInputStream(new ByteArrayInputStream(attachment.getAttachment())); > > return Action.SUCCESS; > > > > } > > } > > I would appreciate any hints in this regard, thanx. > > > > > > __________________________________________________________________ > > Instant Messaging, free SMS, sharing photos and more... Try the new Yahoo! > > Canada Messenger at http://ca.beta.messenger.yahoo.com/ > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]