aspose file tools*
The moose likes JSP and the fly likes delete records Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "delete records" Watch "delete records" New topic
Author

delete records

jyotsana dang
Ranch Hand

Joined: Sep 26, 2003
Posts: 135
i have a link to the deletion page in jsp..in whcih the first 5 records that have been stored by the user are shown..and a checkbox besides each..
on checking the box/ boxes and on clicking the delete button the records get deleted..
how do we implement this thing with JSP.
Praful Thakare
Ranch Hand

Joined: Feb 10, 2001
Posts: 637
Jyotsana,
Check out if follwing example helps you,

here I go......
give same name to all your checkbox and value as primary key of record to be deleted...
say I have an record identified by rollno ,so while displaying record I will use following code...
.....
....//select statement and all...
while(rs.next())
{
out.pritnln("<tr><td><input type=checkbox name=deletedRec value="+rs.getString("rollno")+........."</td></tr> ) ;

}
...
...

so In your example you will get 5 check box,all with name deleteRec.but different values...
now when you click on delete button,all selected check boxs value will be added to request,which can be collected as
String ids[]=request.getParameterValeus("deleteRec");

now using this string array you can construct query as
delete from soNso where rollno in(ids from array);
Hope this helps
Cheers
Praful
[ March 01, 2004: Message edited by: Praful Thakare ]

All desirable things in life are either illegal, banned, expensive or married to someone else !!!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: delete records