0
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")
public class DeleteController {
@Autowired
private ArticleService articleService;
@RequestMapping(value="/delete")
public String deleteService(@RequestParam("ID") final Integer ids) {
System.out.println("hello");
articleService.deleteService(ids);
return "redirect:/articles";
}
}
여기 ~~~~~~~~~~~~~~~~~~~~~~springMVC, 링크를 삭제하는 방법 (HREF)
<td><a href="/articles/delete.do?ID=${article.articleId}">delete</a></td>
이 문제가 될 수 있습니다 단지 나에게 lot.I을 잘 접착은 (두 번째 시도) href가
의 링크를 파악할 수없는 href.Controller의 문제가 될 수 있다고 생각하지만, 그것은이
import net.roseindia.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
@Controller
@RequestMapping("/articles")
public class DeleteController {
@Autowired
private ArticleService articleService;
@RequestMapping(value="/delete/{ID}")
public String deleteService(@PathVariable("ID") final Integer ids) {
System.out.println("hello");
articleService.deleteService(ids);
return "redirect:/articles";
}
}
td><a href="/articles/delete/${article.articleId}.html">delete</a></td>
이런 식으로 작동하지 않습니다 또한 보인다 내 web.x입니다. /articles/delete/2.html
유형 상태 보고서
메시지 /articles/delete/2.html
- ml의<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
Promble는
HTTP 상태 404
설명 요청한 리소스를 사용할 수 없습니다.
귀하의 질문은 무엇입니까? – BevynQ
delete ----- 컨트롤러 – Yuxin
에 의해 파악되는데 작동하지 않습니다. 괜찮아 보이는데 예외가 있습니까? – BevynQ