当我单击JSP页面中的SAVE按钮时,看到404 NOT FOUND ERROR消息,这对spring MVC来说是非常陌生的东西,我被困在这里,请帮助
我尝试了以下代码段,请参考并同行公会。
这是我的display.jsp页面,其中显示特定部门的员工列表
<form:form method = "POST" action = "/updateEmployeeDetail/${employeeList}">
<td><input type="submit" style="width:10%; color:darkblue;background-color:white;float: right;" value = "save" /></td>
</form:form>
<table class="table table-bordered" style="width: 300px">
<tr>
<th style="color:darkblue">Name</th>
<th style="color:darkblue">Grade</th>
<th style="color:darkblue">Start Month</th>
<th style="color:darkblue">End Month</th>
</tr>
<c:forEach var="employee" items="${employeeList}" >
<td width="60" align="center">${employee.empName}</td>
<td width="60" align="center">${employee.grade}</td>
<td width="10" align="center"><input type="text" path="startMth" /></td>
<td width="10" align="center"><input type="text" path="endMth" /></td>
</tr>
</c:forEach>
</table>
当我输入startMth和endMth并单击保存按钮时,它应从控制器调用updateEmployee方法。 下面是EmployeeController.java
@RequestMapping(value="/updateEmployeeDetail/${employeeList}", method= RequestMethod.POST)
public ModelAndView updateEmployee(HttpServletRequest request, HttpServletResponse response, @ModelAttribute("employeeListNew") List<Employee> employeeListNew)
{
for(Employee employee:employeeListNew)
{
//get employee deatils to perform some calculations and saves the data in database
}
return model;
}
当我单击保存按钮时,它将显示404找不到,单击保存按钮后,它没有调用此方法updateEmployee 请帮助我解决这个问题。