Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Download CSV file from apllication server

 
felix thomas
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic