File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes how to delete the row on click of a checkbox instantly ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "how to delete the row on click of a checkbox instantly ?" Watch "how to delete the row on click of a checkbox instantly ?" New topic

how to delete the row on click of a checkbox instantly ?

sanat meher

Joined: Nov 06, 2008
Posts: 18
Hi all,

Can anybody tell me how to make a row disappear on click of checkbox and clicking or submiting the form.

I have a form which shows the data from a table in the database in tabular fashion(row and columnwise).And corresponding to one column i have associated a checkbox fro each row of the datable.So when i select one or more than one checkbox,and click on the submit button,it will perform some action and display those selected items in the same form or different form.but i click the submit button,then those selected rows are still there and when i refresh the page then only those are getting disappeared.but i want those selected columns to be disappeared instantly on clicking the submit button without refeshing the page repeatedly.
Can anybody tell me how to do the same.

My code is like this:

Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
Not a good idea to put all this logic in the view/JSP. You should probably refactor it to a servlet or preferably the model. For what you are trying to do, you can have some javascript code that will execute on the click event of the checkbox, and call your backend method to do the delete.

So much trouble in the world -- Bob Marley
Soumik Basu
Ranch Hand

Joined: Oct 01, 2007
Posts: 40
I would suggest that you use AJAX.Then you need not have to submit also and get the page refreshed.
All you need to do is learn using AJAX from some tutorials and put your to be shown table in a div tag and on click of the button(which was your submit button previously)call the method written in AJAX and through AJAX call another jsp or servlet where you write the query for deleting the row.
Don't get me started about those stupid light bulbs.
subject: how to delete the row on click of a checkbox instantly ?
Similar Threads
exception java.sql.SQLException: Exhausted Resultset
how to fetch the value of the checkbox in jsp?
how to pass multiple values through hyperlink to a jsp page ?
value not passing to the while loop
how to delete the rows which are checked