Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JSP-Servlet Jsp-delete checked checkboxes and display UNCHECKED checkboxes in table as well as in store that unchecked checkboxes in ARRAYLIST
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


rahul
Jsp-delete checked checkboxes and display UNCHECKED checkboxes in table as well as in store that unchecked checkboxes in ARRAYLIST
2 Answer(s)      4 years ago
Posted in : JSP-Servlet


I have a table with about 20rows, which contain a checkbox and a bit of text each. What I'm trying to find a way to do is to have delete button at the bottom of the page.When i clicked on DELETE button, it should delete records of checked checkbox rows. I need to delete all the table rows which contain CHECKED textboxes.and remaining checkboxes should be displayed. And we should keep remaining checkboxes in ARRAYLIST.

I want to delete checked checkboxes.And store all unchecked checkboxes in Arraylist(collection). and print that arraylist.

I've been able to get bits of it to work at various times, but I'm running out of time and I really need help. Any suggestions anyone has would be more than appreciated! Please,Help me Thanks!


Advertisement
View Answers

October 28, 2010 at 12:32 AM


I am not sure that I have clearly understood your question. I think you want to show the records of a table in a form and the checked records are to be deleted from the table after clicking the DELETE button.

If this is your question for this, you can do the following:

  • Create a form that retrieves values from the table. Use form tag and checkbox input. In in each checkbox retrieve the data from table and show. Use the ID (primary key) of the record as the name attribute in checkbox. This will show as many checkboxes as records in your table.
  • Use submit or button to post the form information to page. Check for which ID (primary key) the checkbox is "on" and for which it is null. For "on" checkboxes delete the record and for null add them to ArrayList. Use if-else for this.

    rs = stmt.executeQuery("SELECT emp_id FROM emp");

    while (rs.next) { String checkbox = request.getParameter("emp_id"); if (checkbox == null ) { al.add(Object); } else { stmt1.execute("DELETE emp WHERE empid"+ = empid); } }

I have written this code assuming that it's a part of a file. You will have to create ArrayList, connection, statement, etc. I hope this will help you.



October 28, 2010 at 10:43 AM


Thanks for your valuable reply... But I have a arraylist of records. From that arraylist , if i want to delete some records of table ,then using checkboxes,after checking some of checkboxes, i want to delete selected (checked)checkboxes.And remaining checkboxes should be retained in that arraylist. So, previous arraylist is replace by new arraylist with same name.

Please, can you give me some code.Actually i tried hard to get it.But i am going out of time.So, please help me.

Thanks in advance !!!!!!! :)



Related Tutorials/Questions & Answers:
Jsp-delete checked checkboxes and display UNCHECKED checkboxes in table as well as in store that unchecked checkboxes in ARRAYLIST
Jsp-delete checked checkboxes and display UNCHECKED checkboxes in table as well as in store that unchecked checkboxes in ARRAYLIST  I have a table... in ARRAYLIST. I want to delete checked checkboxes.And store all unchecked checkboxes
Remove checked checkboxes from arraylist and dipaly remaining arraylist
Remove checked checkboxes from arraylist and dipaly remaining arraylist  I want to delete checked checkboxes after submitting button. And i want... array.I am able to display all arraylist items which i want to delete. But i am
Advertisements
help me in disabling checked checkboxes
, it should display previoue checked checkboxs as disabled.and remaining checkboxes...help me in disabling checked checkboxes  <%@ page language="java... in this code....such that... when i select some checkboxes and submit this form
how to display selected checkboxes dynamically using jsp
how to display selected checkboxes dynamically using jsp  Hi friends i have a requirement that : in my JSP page i have radio buttons followed by the DB fields..when i click SUBMIT button,if the field(or record
List of checkboxes - JSP-Servlet
with a checkbox against every such time-slot in a JSP page. My requirement is that when one or more checkboxes are checked and the delete button is clicked, then the selected time slots should be deleted. The time slots are getting added in ArrayList
The checkboxes tag
In this section, you will learn about checkboxes tag of Spring form tag library
deffernce between checked and unchecked exception in java
deffernce between checked and unchecked exception in java  What is deffernce between checked and unchecked exception in java please explain by example
Maintaining States of Selected CheckBoxes in Different Pages using dispaly table in struts2
Maintaining States of Selected CheckBoxes in Different Pages using dispaly table in struts2  Hi, I am working in a Struts 2 project where in the jsp.... Actually my requirement is to select particular checkboxes across different pages
How to add a column with checkboxes for each record in my table in JSP
How to add a column with checkboxes for each record in my table in JSP  ... boxes for each record in my table in JSP? Also, I want to figure out a way that what records the user has checked! If you could give me the answer with an example
checkboxes set to true using JavaScript
checkboxes set to true using JavaScript  To set all checkboxes to true using JavaScript
Array of checkboxes - Struts
Array of checkboxes  How to handle unknown number of checkboxes using tag in an ActionForm.   Hi friend, Code for multiple checkbox import javax.servlet.http.HttpServletRequest; import
Updating multiple value depending on checkboxes
Updating multiple value depending on checkboxes  Hi .. I want to Update the multiple values of database using checkboxes and want to set the session for selected checkboxes..? please answer if any one knows as soon as possible
List of checkboxes - JSP-Servlet
the response but now it displays only the last value of ArrayList. In other words..."); String em=request.getParameter("endsMin"); int index=0; ArrayList al=new ArrayList(); if(sh!=""&&sm!=""&&eh!=""&&em!="") { int nsh=Integer.parseInt(sh
Retriving multiple values of checkboxes in struts
Retriving multiple values of checkboxes in struts  how to retrive multiple values of checkboxes of jsp in action class   JSP Retrieve checkbox values 1)checkbox.jsp: <html> <body> <form method="post
unchecked exception
unchecked exception  What happens if the service method throws an unchecked Exception
dropdown wth checkboxes - Design concepts & design patterns
dropdown wth checkboxes  Hi Friends, Instead of using Ctrl key i want to put checkboxes inside the dropdown,then we can check the options whatever...++){ if(document.form.nums[i].checked) total +=document.form.nums[i].value + "\n
how to get data from checkboxes - JSP-Servlet
how to get data from checkboxes  hi, i got list of tables on screen by invoking webservices.when the user selects the tables by using checkboxes, i need to get only those tables to the next page where i can get list of columns
JavaScript Array of checkboxes
JavaScript Array of checkboxes   ... that help you in understanding JavaScript Array of checkboxes. For this we...;!document.form1.sex[1].checked){ alert("Please Select Sex"
How to execute mysql query based on checkboxes values in java swing application.
How to execute mysql query based on checkboxes values in java swing application.  Hello Sir, I have a java swing application and i have to execute query based on selection of checkboxes.Means I have to to execute
How to execute mysql query based on checkboxes values in java swing application.
How to execute mysql query based on checkboxes values in java swing application.  Hello Sir, I have a java swing application and i have to execute query based on selection of checkboxes.Means I have to to execute
How to execute mysql query based on checkboxes values in java swing application.
How to execute mysql query based on checkboxes values in java swing application.  Hello Sir, I have a java swing application and i have to execute query based on selection of checkboxes.Means I have to to execute
how to update combobx's selected value to database with respect toselected multiple checkboxes
how to update combobx's selected value to database with respect toselected multiple checkboxes   suppose this if form1.jsp in which i am going to display records from database out.println("<tr><td>"+"<input type
want to ask how to update data for runtime selected multiple checkboxes
have checkboxes for each record when I will select more than one checkboxex...); //alert("enter"); if(f1.elements[cnt].checked==true){ values[j]=f1.elements...("<table Id=dataTable border=1 bordercolor=#8080cc bordercolorlight=#8080c0
After changing url params d req checkboxes are not showing as clicked in jsf programming - Java Server Faces Questions
to store the state of checkboxes of albums. But when u again modify... After changing url params d req checkboxes are not showing as clicked in jsf... artistname then the respective albums(with their checkboxes) will show up like
Making Exceptions Unchecked - java tutorial,java tutorials
Checked and Unchecked Exception In this section, you will learn Checked and Unchecked Exceptions in java and how to handle it. The Exception is a condition... below types of built-in exception in java : 1. Unchecked Exception 2. Checked
How to insert multiple checkboxes into Msaccess database J2EE using prepared statement - Java Beginners
How to insert multiple checkboxes into Msaccess database J2EE using prepared... statement to do the checked boxes part, I'm not sure how to go about doing... corrected a few more errors, mainly in the jsp portion and it's working fine now
required treenodes checkboxes are not clicking if u change the url - Java Server Faces Questions
required treenodes checkboxes are not clicking if u change the url  Hi, Here i have Library.java file. just look at d url : http://localhost...); } } public ArrayList getLibraryAsList(){ ArrayList appendTo = new ArrayList
store input and display previous input as well current input. in jsp
store input and display previous input as well current input. in jsp  Hi Friend, In this JSP program i want display the previous input as well... am trying to take new input it replaces old one. i want to store and display
Maintain checked checkbox status
display that "selected checked checkboxes" in same page but in another table...Maintain checked checkbox status  Hi everyone In my JSP application, i have database table stored in mysql. when i display there recors using
JavaScript Checkbox In DropDown box
to display the checkboxes inside the dropdown box. Now to implement this, we have used a div tag inside which we have created checkboxes. And if you want to get the selected values, select the checkbox (or checkboxes) and click the button
Displaying checked checkbox in same page as well as print on another page ....also add next pages cheches checkbox into previous list
Displaying checked checkbox in same page as well as print on another page... same checkboxes. So, from your above code, i can display selected checkbox on same..., it does not display previous page's selected checkboxes. So, i want such output
Advertisements
 

 

 

DMCA.com