Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to i delete the record from table ?  RSS feed

 
Alvin chew
Ranch Hand
Posts: 834
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi, i have plenty of rows' record, which generated from user keyin data after user click on "add" button, and using ArrayList and HttpServletRequest

my doubt is , after the table record display , how to i delete certain row of record ? and also, if the records first column with the unique sequence number indication, when second record deleted , how the following number match back ? means initial third record with sequence number "3" now become "2" instead due to second record deleted ...

should i hv checkbox or just delete button beside of every single row for deletion, which one is better idea in sense of easier maintenance and coding

anyone mind to guide me on this ? thank you very much for guiding
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whether you use a checkbox or individual delete buttons is really a matter of your choice. Checkboxes would allow you to delete several records together, though.
As to identifying the records to be deleted, you need be able to reconstruct the database primary key from the infomation you submit to your servlet. Assuming you have a non-composite integer key, you can use that as the name of the checkbox.
 
Alvin chew
Ranch Hand
Posts: 834
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi, Ulf Dittmer , when user click "add" button for record adding, the record is not yet insert into database, which is temporary data ..
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For new data you don't need a key to insert into the database, as the DB will usually auto-generate it for you. So you can give the input fields generic names which your servlet can use to retrieve their values.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!