跟着网上的视频敲示例代码,然后就报错了...
Web页面代码:
<!-- REST PUT -->
<form action="test/restPut/2" method="post">
<input type="hidden" name="_method" value="PUT"/>
<input type="submit" value="REST PUT" />
</form>
Controller代码:
@Controller
@RequestMapping("/test")
public class SpringRequestMapping
{
// 成员属性;
private final String SUCCESS = "success";
/**
* 功能描述:测试RESTful PUT;
* @param id
* @return
*/
@RequestMapping(value = "/restPut/{id}", method = RequestMethod.PUT)
public String restPut(@PathVariable("id") Integer id)
{
System.out.println("RESTful PUT:" + id);
return SUCCESS;
}
}
web.xml
<filter>
<filter-name>HiddenHttpMethodFilter</filter-name>
<filter-class>org.springframework.web.filter.HiddenHttpMethodFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>HiddenHttpMethodFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
新手求助,麻烦大神指点一二,问题出在哪了???
侃侃无极
慕神8447489
相关分类