Hi I am trying to get a value from the textboxes inside my element in my table. I have an edit button for each row that should go to the servlet, update the fields, refresh the table data and come back to the same jsp page.
Here is my table
<table border="2">
<tr>
<th>ID</th>
<th>Short Desc</th>
<th>Long Desc</th>
<th>Status</th>
</tr>
<c:forEach var="state" items="${stateList}">
<tr>
<td><input type="text" name="editStateId" value="${state.stateId}"/></td>
<td><input type="text" name="editShortDesc" value="${state.shortDesc}"/></td>
<td><input type="text" name="editLongDesc" value="${state.longDesc}"/></td>
<td><input type="text" name="editIsActiveString" value="${state.isActiveString}"/></td>
<td>
<form action="witc" method="post">
<input type="hidden" name="action" value="manageDispoType">
<input type="hidden" name="stateId" value="${state.stateId}"/>
<input type="hidden" name="manageType" value="stateType">
<input type="submit" value="Edit" class="editbuttons"/>
</form>
</td>
</tr>
</c:forEach>
</table>
In my servlet I have am trying to get the values from these textboxes to add to a state class and update the database. I am using request.getParameter() but I am getting a null value
Here is my servlet
private String doManageType(HttpServletRequest request, HttpServletResponse response){
String urlString;
StateType stateType = new StateType();
List<StateType> stateList = GetDb.getAllStates();
//below is the code I'm having trouble with
String shortDesc = request.getParameter("editShortDesc");
String longDesc = request.getParameter("editLongDesc");
String isActive = request.getParameter("editIsActive");
request.setAttribute("stateList", stateList);
stateType.setShortDesc(shortDesc);
stateType.setLongDesc(longDesc);
stateType.setIsActiveString(isActive);
UpdateDb.updateState(stateType);
urlString = "/manageTypes.jsp";
return urlString;
}