File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Deleting multiple row using checkbox Using Servlet and Jsp

 
Chirag dave
Greenhorn
Posts: 3
Java MySQL Database Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
out.println("</select>");
out.println("<link rel='stylesheet' type='text/css' href='css/table.css'/>");
out.println("<input type='text' id='searchText'/>");
out.println("<input type='hidden' id='hide' value='" + selected + "'/>");

out.println("<input type='button' value='Search' onclick='getData()'/>");
out.println("<br/><br/>");
out.println("<input type='button' id='edit' value='Edit' onclick='edit(" + row + ", " + column + ")'/>");
out.println("<input type='button' id='save' value='Save' onclick='save(" + row + ", " + column + ")'/>");
out.println("<table border='1' class='table'>");
out.println("<tr>")

out.println("<td>");
out.println("<input type='checkbox' id='chkbox' name='chkbox'/>");
out.println("</td>");
for (int i = 1; i <= rsmd.getColumnCount(); i++) {
out.println("<td>" + rsmd.getColumnName(i) + "</td>");

}
out.println("</tr>");
while (rs.next()) {
out.println("<tr>");
out.println("<td>");
out.println("<input type='checkbox' id='chkbox' name='chkbox'/>");
out.println("</td>");
for (int i = 1; i <= rsmd.getColumnCount(); i++) {
out.println("<td><input id='" + tr + "_" + i + "' type='text' value='" + rs.getString(i) + "' disabled/></td>");
}
tr++;
out.println("</tr>");
}
out.println("</table>");
tr = 0;
} catch (Exception ex) {
out.println(ex.toString());
} finally {
out.close();
}
}


what i want is ..on selecting heading check box...all the below check box should get selected....and clicking on delete button which i will create later on...i want multiple rows to be deleted from database

please refer image
gold.PNG
[Thumbnail for gold.PNG]
 
Surendra Kumar
Ranch Hand
Posts: 236
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This has to be done using JavaScript on client side.
Please google for it and you can find a lot of code examples.
 
Kumar Raja
Ranch Hand
Posts: 547
2
Hibernate Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1 ) Please use code tags.

2) Prefer rendering the page using jsp or relative technology rather than using servlet to print.

3) As another poster suggested, you will basically need to send the details of what needs to be deleted from client using form get/post , ajax etc etc as HTTP request to servlet for the job ( delegate the actual deletion to DAO).

What did you do so far, apart from printing the page ?

 
Chirag dave
Greenhorn
Posts: 3
Java MySQL Database Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

what i want is ..on selecting heading check box...all the below check box should get selected....and clicking on delete button which i will create later on...i want multiple rows to be deleted from database

please refer image
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic