jQuery in Action, 3rd edition
The moose likes Servlets and the fly likes servlet(delete) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "servlet(delete)" Watch "servlet(delete)" New topic


janet ilieva

Joined: Feb 02, 2001
Posts: 11
I write a report servlets (employee report)
Name SSN Birthdate
Mary 12345789 12/05/1970
... etc
I like to write some delete servlet with checkbox(delete) ,for every row in the table this is to choice for example first, or third employee record to delete.
checkbox Name SSN Birthdate
x Mary --- ------- for example I click the checkbox in this row because I like to delete this Name,SSN,Birthdate.
It's possible somebody to help me to write some code for this problem.
This is for practice , because I study servlets.
narayan kulkarni

Joined: Jan 31, 2001
Posts: 17
Yes its possible to do that
After you check a name to be deleted from the database you need to click a submit button to invoke a servlet
In the delete servlet read the values from the checkbox which has the 'checked' value as true, I hope it is checked ..Refer HTML read the value from that checkbox in your form and execute appropriate sql statement to delete the chosen record like
Delete from Employee where name='<the value chosen from the checkbox>'
This would be same as deleting mails from your inbox in yahoo or hotmail

Take up computer programming as fun and you will just enjoy it. Always keep in mind that in some way your program is going to make human life easier.
Suneel Setlur
Ranch Hand

Joined: Nov 26, 2000
Posts: 202
Hi Janet
Don't know how much this will help you but try it out.


Suneel Setlur
Ranch Hand

Joined: Nov 26, 2000
Posts: 202
You can run the servlet when you have the connecting servlets ready, else will give you errors as it calls 2 servlets.
One for picking up login information
Two for transfering the control to the Delete option
In the delete servlet you can write the code to receive the list and using StringTokenizer can take the number parse it to an int and check with the record in resultset and delete.
Peter den Haan
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
Originally posted by Suneel Setlur:
[B]Don't know how much this will help you but try it out.


A note of warning: with all these static resources sitting there, this servlet is not threadsafe! It should implement SingleThreadModel or your application will collapse in a big heap as soon as it gets a serious load.
- Peter
I agree. Here's the link: http://aspose.com/file-tools
subject: servlet(delete)
It's not a secret anymore!