Re: Tiles and file download

2004-11-26 Thread erh+struts
On Tue, Nov 23, 2004 at 09:43:19AM -0600, Matt Bathje wrote: > My only problem with doing it this way is it changes the mime-type of > the file sometimes, which makes it harder for users to download. > Depending on the userbase you may or may not have this problem. The problem with usin

Re: Tiles and file download

2004-11-25 Thread Dakota Jack
If you are going to do this, you might as well generalize it to: public class FileToString { public synchronized static String convert(File input) throws FileNotFoundException { String output = ""; String line = ""; StringBuffer content = new StringBuffer();

Re: Tiles and file download

2004-11-25 Thread andy wix
Hi, I have resolved this now. The action code is: File f = new File("test.log"); BufferedReader in = new BufferedReader(new FileReader(f)); String str; while ((str = in.readLine()) != null) { buf.append("\n" + str); } in.close(); request.setAttribute("FILE", buf.toString()); and the jsp code (not

Re: Tiles and file download

2004-11-24 Thread andy wix
Hi, Still can't get anything sensible to work. I've gone with the approach of setting a variable in scope for the 'body' tile jsp to output, as I have to use Tiles so that the user can still see the menu etc after the operation. My code is: File f = new File("C:/test/logs/test.txt"); StringBu

Re: Tiles and file download

2004-11-23 Thread Dakota Jack
Perhaps a bit of "theory" is what you need. When you return a resource such as a file from an Action with a null as the value of the ActionFoward, you do so because the action is called FROM the response or the page which has already been committed and presented to the client. The call to the act

Re: Tiles and file download

2004-11-23 Thread Dakota Jack
As you no doubt see, Paul's solution is for viewing in the browser and Matt's is for downloading to the client. You can do both if you like. Just make the file in the browser per Paul the button for downloading the file to the client per Matt. You can have the button do a popup which then shows

Re: Tiles and file download

2004-11-23 Thread Matt Bathje
to a request scoped attribute. The contents of this attribute can then be displayed in the relevant tile. Paul -Original Message- From: Matt Bathje [mailto:[EMAIL PROTECTED] Sent: 23 November 2004 14:40 To: Struts Users Mailing List Subject: Re: Tiles and file download andy wix wrote: Hi, I ha

RE: Tiles and file download

2004-11-23 Thread Paul McCulloch
To: Struts Users Mailing List > Subject: Re: Tiles and file download > > > andy wix wrote: > > Hi, > > > > I have a requirement to allow the user to view log files in > the main > > body tile when they click a certain menu item in the 'menu tile'.

Re: Tiles and file download

2004-11-23 Thread Matt Bathje
andy wix wrote: Hi, I have a requirement to allow the user to view log files in the main body tile when they click a certain menu item in the 'menu tile'. I see on the archives that the normal way to do this is to stream the file to the response and then return null from the action. What's the

Tiles and file download

2004-11-23 Thread andy wix
Hi, I have a requirement to allow the user to view log files in the main body tile when they click a certain menu item in the 'menu tile'. I see on the archives that the normal way to do this is to stream the file to the response and then return null from the action. What's the approach taken