how to capture IE browser FileDownload box open ,save and cancel event

Ads
 

how to capture IE browser FileDownload box open ,save and cancel event

View Answers

September 11, 2008 at 4:43 PM

Hi friend,


To Download a file :


1.Create a Jsp page having Download Button.

<HTML>
<HEAD>
<TITLE>File Download</TITLE>
<script>
function fileDownload(){
window.location.href="filedownload.jsp";
}
</script>
</HEAD>

<BODY>
<input type="button" name="file" value="Download" onclick="fileDownload();">
</BODY>
</HTML>

2.Create a jsp page "filedownload.jsp" to download the file.

This code download the text file.

<%@ page import="java.io.*,java.util.*" %>
<%
try
{
InputStream bis = new FileInputStream("c:/data.txt");
response.reset();
response.setContentType("application/text");
response.setHeader("Content-disposition","attachment; filename=" +"data.txt");
byte[] buf = new byte[1024];
int len;
while ((len = bis.read(buf)) > 0){
response.getOutputStream().write(buf, 0, len);
}
bis.close();
response.getOutputStream().flush();
}
catch(Exception e){
e.printStackTrace();
}
%>


Thanks

Ads









Related Tutorials/Questions & Answers:
Capture browser file download event - JSP-Servlet
Capture browser file download event  Hi, I appreciate your help and thaanks for that.But my question was when filedownload dialog box comes in browser,how we can come to know that user has clicked on Open,save or cancel button
save excel file with save and open dilog box
save excel file with save and open dilog box  following is my jsp code it is working correct.. i want to save excel file throgh jsp bt not by hard...");) user should have freedom to save the file in any location so plz give me
Advertisements
how to display csv file directly in IE browser .
how to display csv file directly in IE browser .  here is my code : public String download(){ if(log.isDebugEnabled()){ log.info... open directly in excel file but not in IE . I am using IE 8 with windows 7
How to capture screenshot in url?
How to capture screenshot in url?  Hi, How to capture screenshot and it will store the capture image in url like this http://localhost/xxx/yyy/ it wil not sore C:\ or D:\ it should store like this http://localhost/xxx/yyy
ModuleNotFoundError: No module named 'open-browser'
'open-browser' How to remove the ModuleNotFoundError: No module named 'open-browser' error? Thanks   Hi, In your python...ModuleNotFoundError: No module named 'open-browser'  Hi, My Python
ModuleNotFoundError: No module named 'odoo11-addon-event-registration-cancel-reason'
ModuleNotFoundError: No module named 'odoo11-addon-event-registration-cancel...: ModuleNotFoundError: No module named 'odoo11-addon-event-registration-cancel-reason...-event-registration-cancel-reason' error? Thanks   Hi
ModuleNotFoundError: No module named 'odoo12-addon-event-registration-cancel-reason'
ModuleNotFoundError: No module named 'odoo12-addon-event-registration-cancel...: ModuleNotFoundError: No module named 'odoo12-addon-event-registration-cancel-reason...-event-registration-cancel-reason' error? Thanks   Hi
ModuleNotFoundError: No module named 'odoo9-addon-event-registration-cancel-reason'
ModuleNotFoundError: No module named 'odoo9-addon-event-registration-cancel...: ModuleNotFoundError: No module named 'odoo9-addon-event-registration-cancel-reason...-event-registration-cancel-reason' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'odoo11-addon-event-registration-cancel-reason'
ModuleNotFoundError: No module named 'odoo11-addon-event-registration-cancel...: ModuleNotFoundError: No module named 'odoo11-addon-event-registration-cancel-reason...-event-registration-cancel-reason' error? Thanks   Hi
ModuleNotFoundError: No module named 'odoo8-addon-event-registration-cancel-reason'
ModuleNotFoundError: No module named 'odoo8-addon-event-registration-cancel...: ModuleNotFoundError: No module named 'odoo8-addon-event-registration-cancel-reason...-event-registration-cancel-reason' error? Thanks   Hi, In your
capture
capture  How can i capture values or text selected in drop down menu or in combo box or in any input forms and print it on the same page ?? also the selected value i want to store it in data base. how can i do that?? plzzzz
how to open a web page using proxy in java and handling button event in that web page..?
how to open a web page using proxy in java and handling button event in that web page..?  Sir, what i need is a code which uses proxy address and opens a web page i.e for example and then clicks a "yes" button in that page
How to save value in JSP
How to save value in JSP  Employee Name Time-IN Time-OUT... 324 2012-12-12 save i want to save dis value jsp to action ...how can i get all value ..and store..how can its values goes
How to capture video and then how to store it in mobile memory
How to capture video and then how to store it in mobile memory  Hello there, I'm developing a mobile application where i'm capturing video from... but they are not working properly some of them capture video but doesn't allow me
Drop Down Reloads again in IE..How to prevent this?
Drop Down Reloads again in IE..How to prevent this?  Hi i was using two drop down box..One for Displaying date followed by another for Dispalying.....This is the problem im facing in IE but it works well in Firefox..How to overcome this IE issue
Browser Back Button click event javascript
Browser Back Button click event javascript  I am using the below code but window.onBeforeUnload is not working with back button.. how can i apply the below code for the click event of back button? window.onBeforeUnload
how to insert check box
how to insert check box   how to insert check box into jtable row in swing
Text box control--keypress event
Text box control--keypress event  In my form have a text box...My requirement is... when is type characters in that box... before typing the 3rd character the space should come automatically or programmatically...the sturucture
How to capture output from console into textarea in java?
How to capture output from console into textarea in java?  Hi, I would like to know how can we display the result of a program in java into a textarea instead of displaying it on console. Thanks
How to capture picture from webcam using java
How to capture picture from webcam using java  i want catch the image from web-cam using jsp, If anyone knows please answer me
ModuleNotFoundError: No module named 'mcloud-plugin-browser-auto-open'
: ModuleNotFoundError: No module named 'mcloud-plugin-browser-auto-open' How to remove the ModuleNotFoundError: No module named 'mcloud-plugin-browser-auto-open' error...ModuleNotFoundError: No module named 'mcloud-plugin-browser-auto-open
How to use place hoder in IE(version : 8)
How to use place hoder in IE(version : 8)  how to use placeholder for input field(type=text) and password field (type= password) in IE
How to save file in vi editor?
How to save file in vi editor?  Hi, I am trying to find commands... the commands? Thanks   Hi, Here are the details: How to save file... :w to save the file Type :wq to save and quit Type :q! to quit without saving
How to get browser time zone?
How to get browser time zone?  How to get browser Time Zone and browser date using java concept
How to save image on the server by applet
How to save image on the server by applet  HI, in my project I am... If user want to export this chart as GIF format then this chart should be save as a gif image on the server directory. Can any Body help me how can I do it Thanks
How to save image on the server by applet
How to save image on the server by applet  HI, in my project I am... If user want to export this chart as GIF format then this chart should be save as a gif image on the server directory. Can any Body help me how can I do it Thanks
I need to launch multiple instances of IE browser from one windows M/C on the another windows M/C
I need to launch multiple instances of IE browser from one windows M/C on the another windows M/C  multiple instances of IE browser from one windows M/C on the another windows M/C
how to open java
how to open Java  how to open java file simple Java Example
How to save database data into excelsheet using hibernate
How to save database data into excelsheet using hibernate  How to save database data into excelsheet using hibernate
How to stop window closing in "internalFrameClosing" event.
How to stop window closing in "internalFrameClosing" event.  In an internal frame listener in the internalFrameClosing event I want to ask the user... the frame open as expected. However it always leaves the JDialog visible. If I
how to get browser cookies in java
how to get browser cookies in java  Hi, How to get cookies in serverlet and then print? how to get browser cookies in java? Thanks   Hi, Use following code: Cookie[] cookies = request.getCookies(); for (int i = 0

Ads