Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > File Download Dialog

Reply
Thread Tools

File Download Dialog

 
 
pharaohseti
Guest
Posts: n/a
 
      07-06-2007
Hi to the group...

I have an Excel (XLS) file in my server. I want my ERP users to click
a button and download that file. But i couldn't change web.xml because
of project settings. Because of that i can't use MIME types....

I used this code in my java file:

public void download() {
String filename = "/ornek.xls";
java.io.File file = new java.io.File(filename);
java.io.FileInputStream fis = new java.io.FileInputStream(file);

javax.activation.FileTypeMap ftm = new
javax.activation.MimetypesFileTypeMap();
response.setContentType(ftm.getContentType(filenam e));

response.setHeader("Content-Disposition","attachment; filename="
+ file.getName() + ";");
int iRead;
while ((iRead = fis.read()) != -1) {
response.getOutputStream().write(iRead);
}
response.getOutputStream().flush();
}

and then i put these lines to my jsp page:

<dos:submit value="Download" width="120" islem="download"
id="btnIndirExcel" validation="false" />

dos is our frameworks name. Don't mess with it up.

But when i use this approach and compile, while testing i click and
the dialog opens up i save the file but the Download button becomes
gray until i press F5. How can i find a solution. Thanks a lot...

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
File name is displayed Garbled in "File download dialog box" =?Utf-8?B?SWJyYWhpbS4=?= ASP .Net 0 08-12-2006 06:44 AM
Force Open .OFT file in Outlook do not show File Download Dialog Kele ASP .Net 0 07-14-2005 06:27 AM
How to hide the dialog when execute a dialog based application in VC? yw C++ 3 07-02-2005 03:35 AM
display print preview dialog, not print dialog Matt Javascript 1 11-20-2004 01:18 AM
Strange characters displayed in file name - File Download Dialog - IE Daniel Cardoso ASP .Net 1 09-24-2004 05:19 PM



Advertisments