getting Checkbox values ?

I have JSP page , Doing dbConnection with MySQL

when i checked some of the records to be delete by checking checkbox at perticular raw .. how to do this...

i mean i used :

<%

int j=0;

String[] proj = request.getParameterValues("check"+j);

for(int i = 0;i<proj.length;i++)

{

out.println(proj+"\n");

}

j++;

%>

\and also without :"check"+j

but it did not give me value of it.

============================

can u send me the complete code to do it

i want perticular check box value and delete that row.

please

HOw to do that inform me

and send the code.

[690 byte] By [Ghanshyama] at [2007-10-3 2:29:04]
# 1

[nobr]Well what have you got on your JSP that displays checkboxes?

The name of those checkboxes are the names you check using request.getParameter().

I find the best way to do this is to give all the checkboxes the same name, and make the value the id to delete.

ie on your web page

<c:forEach var="entry" items="${shoppingBasket}">

${entry.name}<input type="checkbox" name="deleteItem" value="${entry.id}"/><br>

</c:forEach>

Given that on the page, all selected checkboxes will be submitted.

The url would look something like /delete.do?deleteItem=7&deleteItem=42&deleteItem=666

Using request.getParameterValue("deleteItem") would return an array of the selected values.

Cheers,

evnafets[/nobr]

evnafetsa at 2007-7-14 19:28:04 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

Hello friend,

Thanks for your kind reply

i am using simple jsp programming , bcoz i m novice in jsp.

and don't know to use JSP tags as u used in your example

and i m not having application like struts.

I have simple application of JSP and just want to retrieve value of Checkbox to be used in DELETE query.

can u understand what i want to say.?

i.e.

when i select 1st 5th , 6th checkbox , i want that much row is deleted when i press delete button

can u explain me how to do this stuff. from JSP page...

by SIMPLE way ....

Thanks

Ghanshyama at 2007-7-14 19:28:04 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...