Download Button

Download Button

View Answers

March 18, 2009 at 4:50 AM

Hi Pradeep

Can you try this

try {
response.reset();
response.setContentType("APPLICATION/OCTET-STREAM/GIF/XML");
if (request.getParameter("fileName") != null) {
out.println(request.getParameter("fileName"));
String str= request.getParameter("fileName");
byte[] bytes = Repository.getFile(str); // thi function(personal) gives me direct byte array of file
str=str.substring(0,str.indexOf("~"));
Integer fileLength = Integer.decode(String.valueOf(bytes.length));
response.setContentLength(fileLength.intValue());
response.setHeader("Content-Disposition","attachment; filename=\""str"\"");
response.getOutputStream().write(bytes);
response.getOutputStream().flush();
response.getOutputStream().close();
response.sendRedirect("FileInfo.jsp");
}
} catch (Exception e) {
e.printStackTrace();
}



This is just an idea how you can fir in your code

Regards
Ranjan









Related Tutorials/Questions & Answers:
Download Button - JSP-Servlet
. 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...Download Button  HI friends, This is my maiden question
Download
Download JDK  How to Download the latest Version of JDK?   Download OST to PST converter from: http://www.osttopst.info
Advertisements
Download.
Download.  I need a swing program to download a file from the server
download
download  how to download the file in server using php code: "<form method="post" action=""> enter the folder name<input type="text" name="t1" > <input type="submit" value="search" name="s1"> </form> <
Button
Button  How to use image for button in JSF
button
button  can i give multiple commands on click of a button? if yes how can i do that?? multiple commands can we retriving dat from database, capturing data, moving to next page.. etc
button
button  can i give multiple commands on click of a button? if yes how can i do that?? multiple commands can be retriving dat from database, capturing data, moving to next page.. etc
download excel
download excel  hi i create an excel file but i don't i know how to give download link to that excel file please give me any code or steps to give download link
file download
file download  I uploaded a file and saved the path in database. Now i want to download it can u plz provide code
Java download
Java download  Hi, Is it possible to download the Java for Linux Centos 6? From where it can be downloaded for Linux Centos 6? Thanks
download - SQL
download  i want download the mysql server  Hi friend, The latest version of MySQL can be downloaded from http://www.mysql.com. Read for more information. http://www.roseindia.net/mysql/mysql5/Installing
Download Java
process of downloading and Installing Java  Hi, How easy is the process of downloading and Installing Java? I have windows 7 machines. Can anyone tell me how to download and install Java? Thanks
FileUpload and Download
FileUpload and Download  Hello Sir/Madam, I have used the below coding for Upload and download file, but it is not stored in database and also it s not download the file with its content... just it download doc with 0 Bytes
FileUpload and Download
FileUpload and Download  Hello Sir/Madam, I have used the below coding for Upload and download file, but it is not stored in database and also it s not download the file with its content... just it download doc with 0 Bytes
FileUpload and Download
FileUpload and Download  Hello Sir/Madam, I have used the below coding for Upload and download file, but it is not stored in database and also it s not download the file with its content... just it download doc with 0 Bytes
FileUpload and Download
FileUpload and Download  Hello Sir/Madam, I have used the below coding for Upload and download file, but it is not stored in database and also it s not download the file with its content... just it download doc with 0 Bytes
FileUpload and Download
FileUpload and Download  Hello Sir/Madam, I have used the below coding for Upload and download file, but it is not stored in database and also it s not download the file with its content... just it download doc with 0 Bytes
FileUpload and Download
FileUpload and Download  Hello sir/madam, I need a simple code for File upload and Download in jsp using sql server,that uploaded file should... be download with its full content...can you please help me... im in urgent i have
wnidows button
wnidows button   How to handle windows back and forward button in struts applications, without using java script
radio button
radio button  On selecting a radio button, it should open a aspx page
html button
html button  when i click the submit button the entered data will be displayed below the submit button please help me
Style in button
Style in button  Hi.... How can I set the button width with fx:style...;Ans: The width of the button will not set by the style because it is the property of the button not the style property of the button.ADS_TO_REPLACE_2 Thanks
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
csv file download
csv file download  Hello Every one, when user clicks download button I want to retrieve data from mysql database table in csv format using java.if you know please send code. Thanks in Advance   Please visit
coding of button
coding of button  What is code of fetching the value of button in a textbox using javascript
flogin button
flogin button  how to pass redirctt url for flogin button...and to retrieve parameters that are passed in that url..to store in our database
create a button
create a button  i have created button inhtml but my jsp is not working,so can u guide me
Back button
Back button  how to redirect to a home page when a back button is pressed in jsp instead of displaying the previous page
Print Button
Print Button  i want the source code for printing details of jform.. so plz help me for source code of print button
uikeyboard done button/return button
uikeyboard done button/return button  Hi everyone!!! Just worried about ..how to return the UIKeyboard on done or return button click in my iPhone... to return the uikeyboard on done button click. Do not forget to call <
button tag
button tag  how do i change button color to black. meant to say i want black button with white text on it   Hi Friend, Try the following... Message: <input type="text" id="msg"><br> <input type="button" value
download oracle jdk 11 - How to download
download oracle jdk 11 - How to download  Hi, Java 11 is released I want to know where to download it for my computer. What is the url to download.../javase/downloads/index.html For windows you can download installer file
button in java
button in java  how can i compare names of two buttons after...(ActionEvent e) { System.out.println("button clicked"); } } Thanks... a beginner.I'm using simple awt components. i want to keep the labels on the button same
JavaScript Hide Button
, the button gets removed. Download Source Code:    ... JavaScript Hide Button...; In this section, you will learn how to hide the button using JavaScript
submit button
submit button  <p>hi I am trying to insert record in database using hibernate in JSP(Netbeans). When I click insert button it should go to insert.java class but fails to go.</p> <ul> <li><p>
on click button php
on click button php  Function in PHP for on click button
handling Button Event in iphone
handling Button Event in iphone  handling Button Event in iphone
php download free
php download free  From where i download php free
php download file script
php download file script  PHP script to download file in IE
Download PDF file
Download PDF file  How to download PDF file with JSF
download code from database
download code from database  how to download files from database
how to download oracle 9i
how to download oracle 9i  how to download oracle 9i
Download file - JSP-Servlet
Servlet download file from server  I am looking for a Servlet download file example
how to download file
how to download file  How do I let people download a file from my page
php download file code
php download file code  PHP code to download the files from the remote server
File Download in jsp
File Download in jsp  file upload code is working can u plz provide me file download
Free download java
Free download java  Hi, Where can I download java for absolutely free and quickly? Thanks
JAVA S/W download
JAVA S/W download  Hi I'm new to JAVA, I want to download JAVA S/W from where I need to download. Please help me with the link. Thank you,  ... download JAVA from http://www.java.com/en/download/index.jsp and click on Free
ModuleNotFoundError: No module named 'download'
ModuleNotFoundError: No module named 'download'  Hi, My Python... 'download' How to remove the ModuleNotFoundError: No module named 'download... to install padas library. You can install download python with following
Free Java Download
Free Java Download   Hi, I am beginner in Java and trying to find the url to download Java. Can anyone provide me the url of Free Java Download ? Is Java free? Thanks

Ads