This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes Struts and the fly likes How to Save Form Data without Using DB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to Save Form Data without Using DB" Watch "How to Save Form Data without Using DB" New topic
Author

How to Save Form Data without Using DB

manoj kumar jena
Greenhorn

Joined: Sep 24, 2007
Posts: 25
Hi Friends,
I have a form which consists of 6-7 fields. i want to save these details into a file and i want to populate those data (from the file) onto
the form. Please suggest me how to do it.
Ulf Dittmer
Rancher

Joined: Mar 22, 2005
Posts: 42954
    
  73
Are you familiar with the classes in the java.io package? They can be used to read and write files. You could also use java.util.Properties class if you can arrange to have those values stored in a Hashtable.
manoj kumar jena
Greenhorn

Joined: Sep 24, 2007
Posts: 25
kindly give me some hint.how to approach it by using java.util.proporties?
would be better if i get any link to these kind of tutorials.
Ulf Dittmer
Rancher

Joined: Mar 22, 2005
Posts: 42954
    
  73
There isn't much to it. Create a Properties object, call the put method to add name/value pairs, and then call store or storeToXML to save it all to an OutputStream. For the output stream you can use a FileOutputStream for the file in which you want to store the data.
[ October 05, 2008: Message edited by: Ulf Dittmer ]
 
rocket mass heater kickstarter
 
subject: How to Save Form Data without Using DB