Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Create a CSV file in the local system dynamically

 
Greenhorn
Posts: 6
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to create a CSV file dynamically in the user's system whoever uses my Application so that I can write data into it and then import it to an Excel.

Once I am done with my Application, I am deploying the WAR file in the Tomcat Server in the Server system. I am trying to use System.getProperty("user.home") for creating the file in a particular path. But the file is creating in the system where the App is deployed (Server system).

Different users will be using the App in different systems,so how can I get the path for creating a file in the Local Host System (user's system)?

Any help will be appreciated.
 
Rancher
Posts: 43016
76
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A web app can't access the client file system. You'll have to store the file somewhere on the server file system and provide a link to download it, or stream the CSV directly to the browser.
 
Sanjay Krishna Bitra
Greenhorn
Posts: 6
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ulf Dittmer wrote:A web app can't access the client file system. You'll have to store the file somewhere on the server file system and provide a link to download it, or stream the CSV directly to the browser.



Thanks Dittmer. I hope, this will help me out. Actually, I want to write the data into CSV and then import the data into Excel Workbook. Can you explain me, how to stream CSV to browser?
 
Marshal
Posts: 25818
69
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When your web application gets a request for the CSV file data, simply write that data to the response.
 
author & internet detective
Posts: 40200
816
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't see the word "servlet" anywhere in this thread, so added it. You need to return the CVS via the HttpResponse of a servlet.
 
    Bookmark Topic Watch Topic
  • New Topic