aspose file tools*
The moose likes Other Open Source Projects and the fly likes Create a CSV file in the local system dynamically Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Create a CSV file in the local system dynamically" Watch "Create a CSV file in the local system dynamically" New topic
Author

Create a CSV file in the local system dynamically

Sanjay Krishna Bitra
Greenhorn

Joined: Jan 10, 2013
Posts: 6

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.


-Sanjay
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42280
    
  64
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.


Ping & DNS - my free Android networking tools app
Sanjay Krishna Bitra
Greenhorn

Joined: Jan 10, 2013
Posts: 6

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?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18657
    
    8

When your web application gets a request for the CSV file data, simply write that data to the response.
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30762
    
156

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Create a CSV file in the local system dynamically