i works in a j2ee project (pojo layer, Dao level (hibernation), service level (spring), view (spring mvc)) I have an article table after each line, I want to add a link to delete it.
this is my look
<c:if test="${!empty articles}"> <table> <tr> <th>Article ID</th> <th>Article Name</th> <th>Article Desc</th> <th>Added Date</th> <th>operation</th> </tr> <c:forEach items="${articles}" var="article"> <tr> <td><c:out value="${article.articleId}"/></td> <td><c:out value="${article.articleName}"/></td> <td><c:out value="${article.articleDesc}"/></td> <td><c:out value="${article.addedDate}"/></td> <td><a href="articles/${article.articleId}">delete</a></td> </tr> </c:forEach> </table>
here is the controller to delete
@RequestMapping(value="/articles/{articleId}", method=RequestMethod.POST) public String deleteContact(@PathVariable("articleId") Integer articleId) { articleService.removeArticle(articleId); return "redirect:/articles.html"; }
this is the level of service
@Transactional(propagation = Propagation.REQUIRED, readOnly = false) public void removeArticle(Integer id) { articleDao.removeArticle(id); }
this is a Dao layer (I'm trying to find an article to delete it)
public void removeArticle(Integer id) {
but when I start the project and click on the delete link, I have a 404 Etat HTTP error 404 - / Spring3Hibernate / articles / 1 description The requested resource (/ Spring3Hibernate / articles / 1) is not available
Can someone help me?
source share