This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes JSP and the fly likes Download CSV file from apllication server Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » JSP
Reply Bookmark "Download CSV file from apllication server" Watch "Download CSV file from apllication server" New topic
Author

Download CSV file from apllication server

felix thomas
Ranch Hand

Joined: Jun 10, 2001
Posts: 89
Hi,

I have created a csv file in the weapps/csv directory. now my problem is i want to download that csv file from a jsp page by giving a link.

i don't want to hard code the server path , is there anyway i can do that

the application server i am using is tomcat. Just by clicking the link the csv file shd download
Amol Fuke
Ranch Hand

Joined: Apr 08, 2005
Posts: 129
You can use the properties file for this.
Read the property with help of ResourceBundle from the file and use it to make the link.

If your server changes you just need to change value of that variable in the property file.


"There are no mistakes, only lessons"
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35443
    
    9
Tomcat will not serve files that are inside the WEB-INF directory, so you will need to create the file somewhere outside of it in a publicly accessible directory, or write a download servlet that reads the file in WEB-INF and streams it to the client for you.


Android appsImageJ pluginsJava web charts
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Download CSV file from apllication server
 
Similar Threads
Important
Force file download
file downloading from the server
generate zip file containing a csv file
is it MIME types?