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

新人求指点,如何点击删除选中的链接,急~~(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
友情链接: 爱易网 云虚拟主机技术 云服务器技术 程序设计技术 开发网站 APP开发教程
Copyright © 2013-2026 爱易网页 当前在线:263人  网站在23时31分31秒内访问总人数:236367人 2秒前 47.55%  粤ICP备18100884号-2