struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Newton <davelnew...@gmail.com>
Subject Re: change the filename to be downloaded
Date Wed, 29 Dec 2010 00:37:18 GMT
http://struts.apache.org/2.x/docs/stream-result.html

On Tue, Dec 28, 2010 at 7:35 PM, maven apache <apachemaven0@gmail.com>wrote:

> Hi jlmagc:
>
> How do you set the contenttype in the result of the action?
>
> 2010/12/27 maven apache <apachemaven0@gmail.com>
>
> >
> >
> > 2010/12/27 <jlmagc@gmail.com>
> >
> >> That's right. I don't have access to the code now, but I will try to
> send
> >> it later. Check the syntax, I'm sure you will find some
> >
> >
> > No hurry. :)  Thanks.
> >
> >
> >> examples
> >> Sent via BlackBerry from T-Mobile
> >>
> >> -----Original Message-----
> >> From: maven apache <apachemaven0@gmail.com>
> >> Date: Mon, 27 Dec 2010 20:42:15
> >> To: Struts Users Mailing List<user@struts.apache.org>
> >> Reply-To: "Struts Users Mailing List" <user@struts.apache.org>
> >> Subject: Re: change the filename to be downloaded
> >>
> >> 2010/12/27 <jlmagc@gmail.com>
> >>
> >> > I do the same, but with an excel, and I'm able to write the excel
> >> direclty
> >> > to an input stream. I don't know about word, but I suppouse it would
> be
> >> the
> >> > same. Also, I think you can set a getFileName method in the action,
> and
> >> it
> >> > can be used as follows
> >> >
> >> >
> >> write the excel direclty to an input stream
> >>
> >> ? How,the wirte method write(OutputStream out),isn't it?
> >>
> >>
> >> > <param
> >> name="contentDisposition">attachment;filename="{fileName}"</param>
> >> >
> >> *<param
> >> name="contentDisposition">attachment;filename="{fileName}"</param>*
> >>
> >> My god. It can be used in this way?  I do not know before. Thanks.:)
> >>
> >> > Sent via BlackBerry from T-Mobile
> >> >
> >> > -----Original Message-----
> >> > From: maven apache <apachemaven0@gmail.com>
> >> > Date: Mon, 27 Dec 2010 19:26:16
> >> > To: Struts Users Mailing List<user@struts.apache.org>
> >> > Reply-To: "Struts Users Mailing List" <user@struts.apache.org>
> >> > Subject: change the filename to be downloaded
> >> >
> >> > Hi:
> >> > In myapplication,I have to generate a ms-word file(I use the apache
> >> poi).
> >> > 1)first I save the generated file to disk.
> >> > 2)set the inputstream according to the file.Of course,the action
> result
> >> > type
> >> > is already set to stream.
> >> >
> >> > here is a exmapleI found about file downing:
> >> > http://www.mkyong.com/struts2/struts-2-download-file-example/
> >> >
> >> > Now,my problem is how to set the filename? Since the filename is set
> in
> >> the
> >> > action in the struts.xml.
> >> >
> >> > <param
> >> name="contentDisposition">attachment;filename="fileABC.txt"</param>
> >> >
> >> > Is there any way can set the filename dynamicly?
> >> >
> >> > BTW,is there some idea can avoid the step for storing the tmp file in
> >> the
> >> > disk?
> >> >
> >> >
> >>
> >>
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message