Hi.
I want to delte row from the dataTable. I have a java class called Book and the datatable on jsp page. How can I write a delete method? Can you tell me how to get an IdBook from the table (when I get id I will be able to delete the correct row from the database). Or maybe you have a better idea.
The DataTable is only a View component for a DataModel. The DataModel is the backing data for the view, and isn't supposed to actually be the Domain Model. In fact, at best, it can only wrap a Domain Model.
In order to "delete a row from a datatable", therefore, you must remove it from the DataModel. You MAY also choose to remove it from the Domain Model (that is, delete the row from the database), but that's up to you. If the DataModel doesn't contain the row, the row won't display. Conversely, you can include rows in the DataModel that aren't necessarily in the Domain model, since you're the one that determines the difference.
Ironically enough, I'm coding almost that exact same sequence myself right now. I'm working on a generic database table editor for a client, since I couldn't seem to find any viable ones in open source. If I'm not too revolted by the final results, you may see it on SourceForge someday soon.
Post by:autobot
This tiny ad is wafer thin:
a bit of art, as a gift, the permaculture playing cards