473,395 Members | 1,987 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How to configure the Download file button in jsp page design?

I am using the Database and get values from result set and stored it as string buffer..i am trying to access string buffer value in function(javascript) but displays the error..can you please help me to resolve the problem..attached my code here..


<script type="text/javascript">
function download(){<%
//Exporting the data
if(sb1 !=null){
response.setHeader("Content-Disposition","attachment; filename=statussheet.xls");
response.setHeader("cache-control", "no-cache");
ServletOutputStream outs = response.getOutputStream();
InputStream fileInputStream = new ByteArrayInputStream(sb1.toString().getBytes("UTF-8"));

byte[] outputByte = new byte[4096];
//copy binary contect to output stream
while(fileInputStream.read(outputByte, 0, 4096) != -1)
{
outs.write(outputByte, 0, 4096);
}
outs.flush();
outs.close();
}%>
</script>
Oct 26 '10 #1
0 1561

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: MarsFossils | last post by:
I am giving a lunch and learn talk on how to "Create your own Web Page" tomorrow and would like to mention a funny anecdote with an inspiring moral about web page design. Does anybody have any...
1
by: Wayne P. | last post by:
Is there a good reference online to good page design in VS.Net? I am used to tools like DreamWeaver and GoLive that make CSS or table bases layouts a breeze. However, it appears that VS.Net lacks...
6
by: Vishal | last post by:
Hello, I am creating an html file in my web form. After the file has been created I want the user to show the messagebox to download this file. Once he has downloaded or canceled the file, then...
1
by: user2008 | last post by:
Hi all, I want to track how many times visitor download file from my website, for example, when visitor click on a download link, a ASPX page will be requested, after that it will redirect to a...
2
by: Leo | last post by:
Dear All, I am developing a search web service, In prototyping I want to download a web page from the internet. Can anyone tell me how to download a web page from the internet. -- Leo
5
by: Bo Yang | last post by:
Hi , It is about one month passed since I post to this list last time . Yes , I use python , I used it in every day normal work , whenever I need to do some scripts or other little-scale works ,...
16
by: matt | last post by:
I have used some free code for listing files for download, but I want to send an email to the administrator when the file has been downloaded. I have got some code in here that does it, but it will...
1
by: R.A.M. | last post by:
Hello, I am learning PHP5. I have little experience. I have created a website in which I want to put a link to download a text file. When I used simple <a href="Dir/File.txt">Download file</a> I...
1
by: ajaymohank | last post by:
Hello friends......... i am new to php. In my project i have to download a java page from a bat file, to the client side by passing values from the program. the problem is that i am getting the java...
3
by: vinodkus | last post by:
dear sir/madam I have to write a code for download file in asp Thanks in advance
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.