I'm trying to pass data from a jsp page to a servlet to process it.
here is the jsp
<c:forEach var="student" items="${requestScope.resultArray}">
<c:set var="id" value="${student.id}"></c:set>
<tr>
<td><c:out value="${student.id}"></c:out>
<td><c:out value="${student.firstName}"></c:out></td>
<td><c:out value="${student.lastName}"></c:out></td>
<td><c:out value="${student.age}"></c:out></td>
<td><c:out value="${student.mark}"></c:out></td>
<td><c:out value="${student.gender}"></c:out></td>
<td><form action="Update" method="post">
<input type="hidden" value="${student.id}" name="stdId"> <input
type="submit" value="Edit" name="edit"> <input
type="submit" value="Delete" name="delete">
</form></td>
</tr>
</c:forEach>
And here is the servlet
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// TODO Auto-generated method stub
String string = (String) request.getAttribute("stdId");
System.out.println(string);
}
The problem is that I'm getting stdId
passed as null to the servlet. What is the problem?