File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes Download CSV file from apllication server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Download CSV file from apllication server" Watch "Download CSV file from apllication server" New topic

Download CSV file from apllication server

felix thomas
Ranch Hand

Joined: Jun 10, 2001
Posts: 89

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

Joined: Mar 22, 2005
Posts: 42965
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.
I agree. Here's the link:
subject: Download CSV file from apllication server
It's not a secret anymore!