日期:2014-05-18  浏览次数:20740 次

新人求指点,如何点击删除选中的链接,急~~(SpringMVC)
<%@  taglib  uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

 
<html>

<head>

<title>All Articles</title>

</head>

<body>

<h1>List Articles</h1>

<a href="articles/add.html">Add Article</a>
 
<c:if test="${!empty articles}">
 
<table>
 
<tr>
 
<th>Article ID</th>
 
<th>Article Name</th>
 
<th>Article Desc</th>
 
<th>Added Date</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.do?actionMethod=delete&ID=${article.articleId}>delete</a></td> 
 //应该是这里写的有问题

</tr>
 
</c:forEach>
 
</table>

</c:if>
 
</body>
</html>






DeleteController.java
package net.roseindia.controller;

import net.roseindia.service.ArticleService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;


@Controller
@RequestMapping("/articles.do")
public class DeleteController {
@Autowired
  private ArticleService articleService;
 /**
   *  @RequestMapping(params = "actionMethod=delete", method = RequestMethod.POST)
public String delete(@RequestParam("id") final Long[] ids) {
List<GoodsBrand> brands = brandService.findDatasByIds(GoodsBrand.class,
ids);
if (brands != null && brands.size() > 0) {
brandService.deleteAll(brands);
}
return REDIRECTQUERYPATH;
}
   * @return
   */
  @RequestMapping(params = "actionMethod=delete")
  public String deleteService(@RequestParam("ID") final Integer ids) {
          System.out.println("hello");
  articleService.deleteService(ids);

      return "redirect:/articles";
      
  }

}


现在就是无法被controller捕获啊

浏览器里面的地址:http://localhost:8080/Spring3Hibernate/articles.do?actionMethod=delete&ID=1
HTTP Status 404 - /Spring3Hibernate/articles.do