I try to send list of Employee from Spring MVC controller and then use it in jsp with forEach loop but receive blank page.
What is wrong?
Here is my code:
@RequestMapping(value = "getuserbylastname", method = RequestMethod.GET)
Employee employee, ModelMap model) {
public ModelAndView searchUserByLastname(@ModelAttribute("employee")Employee employee, ModelMap model) {
List emplList = new ArrayList();
EmployeeDAO employeeDAO = new EmployeeDAOImpl();
emplList = employeeDAO.getByLastname(employee.getLastName());// here list size is 2
model.addAttribute("listOfEmployees", emplList);
return new ModelAndView("redirect:/searchbysurnameresult", "Model", emplList);
}
jsp:
<html>
<body>
<c:forEach var="employee" items="${Model}">
<c:out value="${employee.firstName}"/>
</c:forEach>
</body>
</html>
P.S.I have a taglib url in JSP but there is a problem to display it like code at this site