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 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!

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
web server, it should display previoue checked checkboxs as disabled.and...help me in disabling checked checkboxes  <%@ page language="java... modification in this code....such that... when i select some checkboxes
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
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
The checkboxes tag
In this section, you will learn about checkboxes tag of Spring form tag library
checkboxes set to true using JavaScript
checkboxes set to true using JavaScript  To set all checkboxes to true using JavaScript
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
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
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
unchecked exception
unchecked exception  What happens if the service method throws an unchecked Exception
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...].checked && !document.form1.sex[1].checked){ alert("
Delete multiple records with pagination by selecting checkboxes
and then delete it.Can any one please help me.Also i want to keep the checked check...Delete multiple records with pagination by selecting checkboxes  Hi there,I'm working with PHP.I want to delete my database records which
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
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
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..._TO_REPLACE_1 2. Checked Exception. Unchecked Exception You don't need to import
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
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
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... as well as i aslo include next page's selected checkbox in display list on same... to display selected checkboxs...but in the final display table it should be display
display checked ckeckbox in same jsp page
_TO_REPLACE_2 Now i want to display ,selected checked checkboxes in another table in same...display checked ckeckbox in same jsp page  how to display checked ckeckbox in same jsp page?   Hi, Here is the html code to display check
dispalying arraylist values in table form
dispalying arraylist values in table form  My result is in arraylist and i want to display it in table form using iterator tag
checked and uncheked exception
checked and uncheked exception  please give some information about checked and unchecked exception
cannot display an arrayList in JSP
cannot display an arrayList in JSP  Hello, My bean is called Zone, i... a servlet to a jsp. In servlet.class print("List result = dao.getListZone...=""; int count=0; List viewList = new ArrayList(); Iterator viewItr; Iterator itr
How to display nested ArrayList in JSF
How to display nested ArrayList in JSF  I have a class... to display it in jsf but i dont know how and i am getting mad. I have nested... very well how it works. ADS_TO_REPLACE_1 Please, I need help
JSP - Checkbox remain checked although checked values should depend on values stored in a stateful session bean
JSP - Checkbox remain checked although checked values should depend on values.... There are 3 JSP pages, shop1.jsp , shop2.jsp and shop3.jsp where each of these pages... displays all of the items selected. The selection of items is made using checkboxes
Addin checkbox to table
Addin checkbox to table  how to add checkboxes in JTable
To store value in session & display it
To store value in session & display it  Hello..I m trying to run the following code which will store the session of a book selected on click... Help me in this.. This is the JSP Page <html> <head>
search an element in arraylist and display in jsp page
search an element in arraylist and display in jsp page  Hello Can anyone help how to take input from user from a jsp page to search for a substing in arraylist in java class and display the list in jsp page Thanks
Retrive values from an arraylist and display in a jsp?
Retrive values from an arraylist and display in a jsp?  Hi, I need help in jsp to display values of an ArrayList in jsp. There is a java file containing a method which is returning an ArrayList. I want to display the records
Display items in table
Display items in table  I have a listbox which has some items... in a table. I want these items to be displayed in the table to be unique...i.e. if I reselect those same items they should not be displayed in the table and may
JSP Delete Record From Table Using MySQL
JSP Delete Record From Table Using MySQL This tutorial explains you that how to write a JSP for deleting a record from database table. In this section you.... In this tutorial you will learn that how to delete a record of a database table in JSP
Display JSP selected listbox and checkbox in xml-please help me
as well as checkbox list from database. and in final page it should display all selected listbox as well as selected multiple checked checkboxes. Please help...Display JSP selected listbox and checkbox in xml-please help me  Hi
Want to display Arraylist items on same row in JSF
Want to display Arraylist items on same row in JSF  I want do display values of one arraylist on same row using datatable? If i use h:column, then it goes on different row. Please tell me, how I can do it?   Hi Friend
Retrive values from an arraylist and display in a jsp?
Retrive values from an arraylist and display in a jsp?  Hi, I need help in jsp to display values of an ArrayList in jsp. There is a java file containing a method which is returning an ArrayList. I want to display the records
how to use stringtokenizer on table? and display in table format.
display result in row format  how to use stringtokenizer on table? and display in table format
how to use stringtokenizer on table? and display in table format.
how to use stringtokenizer on table? and display in table format.  table is retrieved from mysql database and each row contains data like(java,c,c++,.net
display:table export only data
display:table export only data  I am using display:table tag with attribute export="true". Using that I can export table data in excel. Here one of the column is in hyper link. But i need to export only data not html tag . Can

Ads