Send 2 values to servlet  employee_id and employee_name along with selected checkboxes values.

puneet kumar
puneet kumar used Ask the Experts™
on
i have a code below where i am traversing a list in jsp containing employee_id and employee_name
<tr>
                                                <td align="top"><INPUT class="inputtext" name="chkBox" type="checkbox" value="<%=employee.get(0)%>" size="50"></td>
                                                <td><label><%=employee.get(0)%></label></td>
                                                <td><label><%=employee.get(1)%></label></td>
</tr>

along with each and every row there is a checkbox when i am selcting chekboxes and click on submit button presently on employee_id (value="<%=employee.get(0)%>") is going along with
checkbox value i want both employee_id and employee_name will go with checkbox value to servlet . in servlet there is a query run and employee_id and
employee_name should be entered into specific table. please help me out on this .please let me know if not clear.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Distinguished Expert 2018

Commented:
You will have to concatenate them both, and then split them in the Servlet.

<td align="top"><INPUT class="inputtext" name="chkBox" type="checkbox" value="<%=employee.get(0)+ "-" + employee.get(1)%>" size="50">

Open in new window


Then on the server side (inside your Servlet) split them based on the minus sign.
puneet kumarSenior Software Engineer

Author

Commented:
Server side when i m getting values  by below

String list[] = request.getParameterValues("chkBox");

i m getting value = [, 12345-puneet]

, also coming please let me know the solution.

i got the issue because i have one common checkbox in header by checking that one it will take , also if i check single single then it will not .please let me know the solution.i need that checkbox because its to difficult to check one by one .
Senior Software Engineer
Commented:
change the name of checkbox because name is same so it is taking value as a null.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial