• Post Reply Bookmark Topic Watch Topic
  • New Topic

Downloading a file with Servlets or JSP - URGENT  RSS feed

 
koray guclu
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I want to make a servlet or JSP to download .cvs excel files.
Those files will be generated on the fly. and will be download
How will I make this?
--------------------

I will use sevlet/Jsp to connect the database and I want to make a .cvs file with the values that I fecth from the database.
I can change the mime type but I will I change extension of the downloaded file?
For example
I will make a link.
index.jsp
-------------
.....
<A HREF="my_cvs_producer.jsp">
Click that link to download the CVS file</A>
.....
the link will point that file.
mycvsproducer.jsp
-------------
.....
change Mime type to text/plain (or is there something else for CVS?)
connect to database
fetch values from the database
display values
close connection
.....
The system is something like that but I donot know
how to change the file name which has an CVS extention.

------------------------
Koray G��l�
(B.s. Computer Engineer)
[This message has been edited by koray guclu (edited July 18, 2001).]
[This message has been edited by koray guclu (edited July 18, 2001).]
 
Theodore Casser
Ranch Hand
Posts: 1902
Hibernate Netbeans IDE PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you could clarify the problem a bit, it might help us help you. Do you need the servlet/jsp to do the downloading or to generate the .cvs to be downloaded? The latter sounds more likely since you mentioned it would be auto-generated, but one never knows.
If you just need it to generate the cvs file, you could easily just have it output the information with a link to save the output to a file on the user's machine, or set up the output with a mime type that would automatically prompt the user's browser to save the file.
Hope that helps at least a little.
------------------
Theodore Jonathan Casser
Sun Certified Programmer for the Java2 Platform
IBM Certified Specialist - WebSphere Application Server, Std. Ed, V3.5
 
Jason Menard
Sheriff
Posts: 6450
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See www.jspsmart.com for their jspSmartUpload bean. This bean also performs downloads.
Jason
 
koray guclu
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have added some more details
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!