This code is written in jsp.it is a dynamic table with rows and columns .When clicked on the submit button,only the selected rows and the data in that row should be fetched into the servlet.
``<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page import="java.io.*,java.util.*,java.sql.*" %>
<%@ page import="javax.servlet.http.*,javax.servlet.*" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Saravana Bhavan</title>
<link rel="stylesheet" href="css/lavish-bootstrap.css"/>
<link rel="stylesheet" href="css/font-awesome.css"/>
</head>
<body>
<form name="f1" method="post" action="Insertcheck.jsp">
<sql:setDataSource var="snapshot"
driver="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:@localhost:1521:xe"
user="system" password="pswd"
/>
<sql:query dataSource="${snapshot}" var="result">
select * from vendormenu
</sql:query>
<center><h3>Saravana Bhavan</h3>
<h4 class="text-muted">Menu</h4></center>
<div class="panel">
<table class="table table-bordered table-responsive" border="2" width="100%">
<tr>
<td>ITEM CODE</td>
<td>ITEM NAME</td>
<td>RATE</td>
<td></td>
</tr>
<c:forEach var="row" items="${result.rows}">
<center>
<tr>
<td><c:out value="${row.mid }"/>
</td>
<td><c:out value="${row.mname }"/>
</td>
<td><c:out value="${row.cost }"/></td>
<td><div class="checkbox">
<label><input type="checkbox" name="yes"></label></div></td>
</tr>
</center>
</c:forEach>
</table>
<br><br>
<center><input type="submit" /></center>
</div>
</form>
</body>
</html>
I need to print the values in each row selected using checkboxes by the user into the servlet from jsp.The rows are added dynamically. How to retrieve all the values from the rows selected?