EDITED: I forgot the following line in my jsp page :| <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%> And this was tha issue
I have an issue with my little application.
I have the following jsp code
<c:forEach items="${movieList}" var="movie">
<tr>
<td>${movie.name}</td>
<td>${movie.genre}</td>
<td>
<form:form method="DELETE" action="/movie/${movie.id}" modelAttribute="movie">
<input type="submit" value="DELETE"/>
</form:form>
</td>
</tr>
</c:forEach>
And I have the following method in my controller:
@RequestMapping(value = "/movie/{id}", method = RequestMethod.DELETE)
public ModelAndView deleteMovie(Model model, @PathVariable("id") long id, Movie movie) {
log.info("I am in delete controller()");
if(movieDao.exists(id)) {
movieDao.delete(id);
model.addAttribute("id", movie.getId());
model.addAttribute("name", movie.getName());
model.addAttribute("genre", movie.getGenre());
return new ModelAndView("doneDeleting");
} else {
return new ModelAndView("error");
}
}
If anyone can help me, because it seems to not work when I click on that DELETE button, since that controller is working from POSTMAN. Many thanks.