I’m trying to set delete buttons on each row of my table in order to let users to delete some rows of the table. However i’m having a terrible time to remove this rows dynamic and remove the data from database… ( no idea how to use the button onclick from html with jsp )
I decided to use some javascript inside the Jsp which did the tricky to remove the row but now i can’t delete the entry from the database…
I would like to know if there is anyway to delete data from the database using the javascript and what should be the easiest way to do it ?
If you want to use JavaScript then you’ll need to send an AJAX request to your server and then remove the row from the view upon success of the previous action.
For an easy and simple approach to AJAX you can try PrototypeJS. However, if you’d like to have really fancy dynamic features you may be more interested in jQuery.
Without knowing more from your project, I’d suggest to use a Servlet in the server side to receive the AJAX request.