delete all checked items
We are trying to develope a complaint register for system administrator using jsp. User can submit the
complaints with details such as the name of department,type of complaint and
date.Every complaints will be displayed with unique check box. Later after servicing, user should be able to select the serviced items using check boxes then delete all the checked items with a single delete button.How can it be done?
pls help....
[455 byte] By [
relnaa] at [2007-11-27 11:11:11]

# 1
Where are you stucking while writing the code? Please ask specific questions.
# 2
hellooo
i am new to jsp..
suppose i have selected multiple items using checkboxes........
how can we know which checkboxes are selected and i also want to delete those selected items from database....
how to do it?
thouht of naming checkboxes with primarykey so that it will uniquely identify that row... but i want to know if there is a better way than this to do it....
hope u understood my question....
relnaa at 2007-7-29 13:46:31 >

# 3
should we give each check box a unique name?
how will we get the list of selected check boxes?
and how can we delete the row associated with those selected checkboxes from database
hope now it is clear to you...
pls help.........
relnaa at 2007-7-29 13:46:31 >

# 4
> should we give each check box a unique name?
No.
> how will we get the list of selected check boxes?
You need HttpServletRequest#getParameterValues().
> and how can we delete the row associated with those
> selected checkboxes from database
Basically using JDBC and SQL.
# 5
form your words I have to know you are using HTML page for designing
suppose if you are created the check boxs with name "orange","apple"..etc
if the orange check box is checked then
value of request.getParameter("orange")==1
ok I hope this one help you
# 6
we know how to connect to the database and to retrive data........
we know how to retrieve values using getParameter method also ............
suppose details of all the complaints are listed one by one in a jsp page....
it is very easy to delete items one by one giving a link "delete" in each row by make use of url rewriting..........
but we want to select multiple items using checkboxes and delete all together using a single delete button just like deleting more than one mails in gmail/yahoo...........
for that we post data from the display page ang get it in next page "deleteItems.jsp".
in order to delete items we should know which check boxes are checked......
how to check this?
help us with this problem
Message was edited by:
relna
relnaa at 2007-7-29 13:46:31 >

# 7
If you want to group checkboxes, assign each checkbox the same name.
The checked values can be retrieved by HttpServletRequest#getParameterValues() then.
# 8
if we give all the checkboxes the same name how will we identify which row in the datbase to delete?
if we use url rewriting, we can post the "complaint id" then delete the row from the database matching that complaint id......
but for group deleting how can we do this.........?
relnaa at 2007-7-29 13:46:31 >

# 9
> if we give all the checkboxes the same name how will
> we identify which row in the datbase to delete?
By it's value. Use HttpServletRequest#getParameterValues() to retrieve a String[] with the checked values.
I've suggested this three times as far. What don't you understand? Haven't you even started with coding and/or reading the API documentation regarding getParameterValues() ?
# 10
we have a list box with some values...
the selected value is inserted into the database
later,after retrieving the same String from result set ,we want it to be set as "selected" in the list box...( for modification purpose)
how will we do it?
Message was edited by:
relna
relnaa at 2007-7-29 13:46:31 >
