• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

reading/writing to a file from JSP

 
Sam Tilley
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I need to create a JSP page that contains 200 checkboxes each worth an amount of money. The idea is that someone will buy a checkbox providing sponsorship for a charity event(they are buying the number of lengths swum in a pool). My task is to create a table of checkboxes which is the easy part, but then i need to grey over the check box once someone has used it, so need to write this to something so that every time someone opens it up it shows which ones have been taken.
The one thing is that i may not have a database to write the info to so have been trying to write it to a text file instead, however i have been having some problems getting the data out of the file and into my JSP using
Is this the best idea to do this or is there another way to store info for a webapplication that is failsafe.
Thanks
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13073
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Reading and writing in the same file is likely to be a disaster.
You should create an object that holds all of the data representing the checkboxes. Keep it in memory and write it out every time it gets changed.
Bill
 
Harry D'Souza
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not a PRO with JSP but this would be my first guess too -- I would want to write to a text file . But instead of having a BufferedReader and a BufferedWriter refering to the same file I would rather use RandomAccessFile which implements the standard input and the output methods.
-Harry.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic