Does this help?
http://wiki.apache.org/struts/StrutsFileDownload
Dave
--- bhaarat Sharma <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I started struts by learning struts2. However, now i am working with
> struts 1: (
>
> I am faced with a problem where user downloads a file.
>
> I have this in the struts.xml
>
> <action path="/viewModificationDocument"
>
>
type="org.something1.something2.actions.download.ModificationDocumentDownloadAction"
> scope="request" input="viewAwardModification">
> </action>
>
> And then in the action I have this which is returning a bytestream
>
> protected class ByteArrayStreamInfo implements StreamInfo {
>
> protected String contentType;
>
> protected byte[] bytes;
>
> public ByteArrayStreamInfo(String contentType, byte[] bytes) {
> this.contentType = contentType;
> this.bytes = bytes;
> }
>
> public String getContentType() {
> return contentType;
> }
>
> public InputStream getInputStream() throws IOException {
> return new ByteArrayInputStream(bytes);
> }
>
> }
>
> But when user clicks a link is sees a open close cancel dialog
> box...he just sees <actionname>.do as file name. I know I am not
> returning the file name (I can) but where will I catch it?? like in
> struts 2...shouldnt tehre be more in the action of this? like
> specifying what is returned? and if i return the name.....should I
> just make public String getFileName() method in ByteArrayStreamInfo
> class?
>
> Thanks!
>
> ---------------------------------------------------------------------
> 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]