I am trying to get a table rows from a JSP page to Servlet but ended up with the following error. What is the correct way of doing it?
Severe: java.lang.NullPointerException
at com.pg.servlet.session.Controller.doPost(Controller.java:125)
java:
String[] recordsToUpdate = request.getParameterValues("attTable");
try {
for (int i = 0; i < recordsToUpdate.length; i++) {
total = SQLHelper.Update(recordsToUpdate[2], recordsToUpdate[3], recordsToUpdate[0]);
}
} catch (Exception e) {
e.printStackTrace();
}
html:
<table id="attTable" class="table">
<tr class="header">
<th>Id</th>
<th>Name</th>
<th>Present?</th>
<th>Remarks</th>
</tr>
<c:forEach var="List" items="${myVar}" varStatus="iter">
<tr class="row">
<td>${List.Id}</td>
<td>${List.Name}</td>
<td><input type="checkbox" name="chkDisperse"></td>
<td>
<input type="text" name="remarks">
</td>
</tr>
</c:forEach>
</table>