• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

Write file to a client system

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am attempting to create a file consisting of data I retrieve from the database on a browser. I am able to create the file on the server side. Can anyone let me know how can I do it on the client side? Essentially, I should be able to ask the user to choose a folder to save the file and write the file there.
I also want to know how can I insert carriage returns in a string that I am writing into a text file.
Any help in this regards would be appreciated.
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi yamini,
You cannot create a file on the client side but you can first generate the file on the server and ask the client to download the file.creating a file on the client side requires access to the client resources which is not possible through a browser.So you have to first write data to the file on the server and allow the user to download it.
I hope that solves your problem to some extent.It may not however be the perfect solution.
Bye for now.
 
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
a) As Prabhat mentioned, usually there will be many security issues come into picture if you want to do anything on the client side. One must keep this in mind, whenever they write any applets or any java related stuff which deals with browsers.
b) You can use writeLine() method from the class RandomAccessFile to write any lines into a file. This feeds in carriage returns at the end of each line.

cheers
Siva
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can also do this through applets using an RSA certificate (either official or self-signed). After a user has accepted you as a trusted site, you will have access to their file directory. We are using this to allow users on our intranet to download binary files, since we have 60,000+ files. Self-signed works well for intranet.

Some useful websites for self-signed certificates are:
http://www.suitable.com/docs/signing.html
http://java.sun.com/products/plugin/1.3/docs/nsobjsigning.html
http://forum.java.sun.com/thread.jsp?forum=63&thread=174214
 
reply
    Bookmark Topic Watch Topic
  • New Topic