Re:number of Files download problem in jsp

Re:number of Files download problem in jsp

I write code for single file downloading , but I want to download number of files at same time , means I want stored number of files in one temp zip file then it download it. please help in this case ...
code :

<%@ page import="java.io.FileInputStream" %>
<%@ page import="java.io.BufferedInputStream" %>
<%@ page import="java.io.File " %>
<%@ page import="java.io.IOException" %>
<%@ page import="java.util.*" %>

<%
String dwFilename ="C:\\downloadJSP\\raj.zip";
response.addHeader("Content-Disposition","attachment; filename="+dwFilename );
// set the http content type to "APPLICATION/OCTET-STREAM
response.setContentType("APPLICATION/OCTET-STREAM");

// initialize the http content-disposition header to
// indicate a file attachment with the default filename
BufferedInputStream buf=null;
ServletOutputStream myOut=null;
try {
myOut = response.getOutputStream();
File myfile = new File(dwFilename);

// set response headers
response.setContentType("text/plain");

response.addHeader("Content-Disposition","attachment; filename="+dwFilename );

response.setContentLength( (int) myfile.length( ) );

FileInputStream input = new FileInputStream(myfile);
buf = new BufferedInputStream(input);
int readBytes = 0;

//read from the file; write to the ServletOutputStream
while((readBytes = buf.read( )) != -1)
myOut.write(readBytes);

} catch (IOException ioe){

throw new ServletException(ioe.getMessage( ));

} finally {

//close the input/output streams
if (myOut != null)
myOut.close( );
if (buf != null)
buf.close( );


}
%>

<p>Files: <%=dwFilename%></p>
View Answers









Related Tutorials/Questions & Answers:
Re:number of Files download problem in jsp - JSP-Servlet
Re:number of Files download problem in jsp  I write code for single file downloading , but I want to download number of files at same time , means I want stored number of files in one temp zip file then it download it. please
upload and download files - JSP-Servlet
upload and download files  HI!! how can I upload (more than 1 file) and download the files using jsp. Is any lib folders to be pasted? kindly... and download files in JSP visit to : http://www.roseindia.net/jsp/file_upload
Advertisements
Upload and Download Large files in jsp
Upload and Download Large files in jsp  I am not able to download large files (>200mb) from any server. I need a code to download and upload large files (atleast 4 gb) to a server using jsp page
Problem in downloading files - JSP-Servlet
Problem in downloading files  Hi, i have uploaded some files using its uploading successfully. but when downloading the same file, its giving...:148) at org.apache.jsp.downloadfile_jsp._jspService(downloadfile_jsp.java:146
how to download the uploaded folder files using jsp
how to download the uploaded folder files using jsp  how to download the uploaded folder files using jsp
upload and download all kinds of files in jsp - Java Beginners
upload and download all kinds of files in jsp  how to upload and download all kinds of files ex: image file,pdf,.xls in jsp. your help is highly appreciated.  we can upload the all type s of files into oracle 10g
Creat a folder, inside it upload and download files in jsp and mysql
Creat a folder, inside it upload and download files in jsp and mysql  Create one or more folder .inside it we can upload and download multiple files... to database. The uploaded files will then displayed on the browser and will allow the user
download pdf files
download pdf files  pls help me,I don't know how to convert .doc,.docx files into pdf files and download that pdf files using servlet or jsp
Upload and Download multiple files
Upload and Download multiple files  Hello Sir/Madam, I need a simple code for upload and download multiple files(it may be image,doc... using jsp with sqlserver ,can you please provide a proper coding for it and also
How to download files from server to local disk using ZIP format in JSP page - JSP-Servlet
How to download files from server to local disk using ZIP format in JSP page  hi i have an application to upload and download multiple files. As i can upload multiple files .now i have to download all uploaded files on local
Problem in jsp.
Problem in jsp.  hello friends, I have a problem in jsp.I want to insert data, which is given by user through a html page into a table.And the table..." action="http://localhost:8080/examples/jsp/insertdata.jsp"> <table> <
Problem in jsp.
Problem in jsp.  hello friends, I have a problem in jsp.I want to insert data, which is given by user through a html page into a table.And the table..." action="http://localhost:8080/examples/jsp/insertdata.jsp"> <table> <
Problem in jsp.
Problem in jsp.  hello friends, I have a problem in jsp.I want to insert data, which is given by user through a html page into a table.And the table..." action="http://localhost:8080/examples/jsp/insertdata.jsp"> <table> <
Jsp problem
Jsp problem  Hello friends.I want to share my jsp problem.I want to show all of my database(mysql) tables except two(user,manufacturer) in a jsp page.plssss help me
jsp problem
jsp problem  problem:::::::: On JSP form ,when i insert data in text field........at that time action is perform and data is retriev from data base and get assign to other field on that form........ when data is assign to other
jsp problem
jsp problem  Hello Friends, I want to show one page for 5 seconds and after that i want to redirect the page to another URL
jsp problem
jsp problem  Hi every one plz give me answer for below question ASAP I created one JSP(used pre defined javascript in jsp to get rtf format in browser) which creats RTF Format in browser to enter data. MY question is after i
JSP Problem - JSP-Servlet
JSP Problem  Hi, I have problem,this is my senario I have one jsp,this jsp having the 3 fields.let me take 3fields userName,emailAddress... for more information, http://www.roseindia.net/jsp Thanks
jsp problem - JSP-Servlet
jsp problem  here is a code for Retrieving image from mysql database through jsp. but i cann't set size of image when it was display so what should... working but my problem is size of image. so can u just help?? code
jsp problem - JSP-Servlet
jsp problem  here is a code for Retrieving image from mysql database through jsp. but i cann't set size of image when it was display so what should... working but my problem is size of image. so can u just help?? code
Upload and Download in JSP - JSP-Servlet
and downloading a file in JSP.. When the admin clicks upload, he must be able to upload files and similarly when the user clicks the download option, he must be able...Upload and Download in JSP  Respected Sir/Madam, I am
jsp problem - JSP-Servlet
jsp problem  hi, i am working on a project of developing a shopping cart for online book store.can it be done using jsp?if yes, can u please help me doing so?  Hi Friend, Please visit the following link: http
problem in jsp programming - JSP-Servlet
problem in jsp programming  Write a JSP program which displays a webpage containing arrival of new items within a particular month in the different... in solving the problem : Connection with mysql database
download or save jsp page
download or save jsp page  hii.., this is my jsp page .. This page is theater ticket. i want to download this page. so i need to save this page or download.. that depend on user wish how to make this page save or download <
download or save jsp page
download or save jsp page  hii.., this is my jsp page .. This page is theater ticket. i want to download this page. so i need to save this page or download.. that depend on user wish how to make this page save or download <
JSP file download - JSP-Servlet
JSP file download  Hi! I am saving (webapp/docs/sample.docx) path of the word file in database. when i want to download that file i am eliminating... on the link it is asking open or save. Upto this is fine..... I want to download
problem in programming - JSP-Servlet
problem in programming  Hi! I am new with jsp. I am facing a problem in programming to calculate the time interval between login time and logout time of user
jsp code problem - JSP-Servlet
jsp code problem  Hi, I have employee details form in jsp. After... have a problem with open the next form. plz, help me. thanks,  Hi.... http://www.roseindia.net/jsp/ Thanks
Session Problem in JSP - JSP-Servlet
Session Problem in JSP  I have developed a online feedback form in JSP platform. I have created normal session in JSP page. It is running in my... normally from Remote machine by only writing JSP code.  Hi friend
Download file - JSP-Servlet
Servlet download file from server  I am looking for a Servlet download file example
File Download in jsp
File Download in jsp  file upload code is working can u plz provide me file download
Download LINK - JSP-Servlet
Download LINK  sorry i am the new1 to java. I am learning and doing the project, can you please send me the complete code. So that i can understand easily. i want the code like by Clicking DOWNLOAD button the SAVE as dialog box
download - JSP-Servlet
download  here is the code in servlet for download a file. while...; /** * * @author saravana */ public class download extends HttpServlet...(); System.out.println("inside download servlet"); BufferedInputStream
Download Button - JSP-Servlet
Download Button  HI friends, This is my maiden question.... And i want the Bank customers to DOWNLOAD the mini statement. Can any one help me how to implement the download button so that on clicking that the mini
java/jsp code to download a video
java/jsp code to download a video  how can i download a video using jsp/servlet
jsp usebean problem - Struts
popupwindow jsp below code run.. ...here iam getting the problem..in the below...jsp usebean problem   --Select... jsp
jsp reload current page problem
jsp reload current page problem  Hi, i am facing problem while reloading the JSP page
jsp reload current page problem
jsp reload current page problem  Hi, i am facing problem while reloading the JSP page
File Upload And download JSP Urgent - JSP-Servlet
File Upload And download JSP Urgent  Respected Sir/Madam, I... Download in JSP.. In the Admin window, There must be "Upload" provision where admin can upload files.. And in the user window, There must be a "Download" provision
setting path problem for org.jfree files - Java Beginners
have those classes which you have import. Download the following jar files...setting path problem for org.jfree files  Hi deepak, As u said, i have downloaded two files jar files and placed them in lib folder to work
Java Problem - JSP-Servlet
Java Problem  How to run a Simple JSP program ? what steps... the webapps folder of apache tomcat. 5)Create a jsp file 'hello.jsp'.You can put your jsp file either inside the web application folder along with WEB-INF or you
download image using url in jsp
download image using url in jsp  how to download image using url in jsp
logout problem?? - JSP-Servlet
logout problem??  sir, the logout code which u have send is not the proper solution coz,by using this code the browser get closed which shuold.../Logout.shtml http://www.roseindia.net/jsp/loginstatus.shtml Thanks
jsp image problem - JSP-Servlet
jsp image problem  hi everyone, How to display multiple images from mysql database to jsp page. please help me
logout problem.. - JSP-Servlet
logout problem..  hi... first of all thanks for ur... but their is some problem with the the logout,i m not able to logout when... done in the code i have used session object in project's servlet and jsp
coding problem - JSP-Servlet
coding problem  dear sir i m very new to JSP sir i m getting problem in dynamically changing the option of combobox from database(ms acess) .and after that option being selected for that the record from the databse should
Uploading Multiple Files Using Jsp
Uploading Multiple Files Using Jsp  ... to understand how you can upload multiple files by using the Jsp. We should avoid to use Jsp for performing any logic, as Jsp is mainly used for the presentation
JSP Upload and Downloading files - JSP-Servlet
and downloading files in JSP, I am facing a problem.. 1) The file name is getting inserted in the database successfully. But When I download the same file, The contents...JSP Upload and Downloading files  Respected Sir/Madam, Very
tomcat problem - JSP-Servlet
the tomcat server. It stops at this stage during installation .......c:\program files... perfectly. Kindly let me know what is the problem at an earliest. Thanking... found your problem.. http://www.roseindia.net/web-application-server/tomcat
JSP code problem - JSP-Servlet
JSP code problem  Hi friends, I used the following code...: <% //to get the content type information from JSP... of: Please can somebody rectify this problem........  

Ads