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 {
[EMAIL PROTECTED]
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]