• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

reading/writing to a file from JSP

 
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic