File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
Author

servlet(delete)

janet ilieva
Greenhorn

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.
Thanks.
narayan kulkarni
Greenhorn

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
Regards


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.

Regards
Suneel


Suneel
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.
Regards
Suneel
Peter den Haan
author
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.

[/B]

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)