「Spring MVC」RequestMethod.PUTの使い方

1.Javaコード
@RequestMapping(value = “/{id}", method = RequestMethod.PUT)
@ResponseBody
public Map<String, Object> update(
@RequestParam(value = “chkForm", required = false) String chkForm,
@PathVariable(“id") String id) {
System.out.println(“id value: " + id);
System.out.println(“chkForm value: " + chkForm);
return null;

}

2.web.xml
<filter>
<filter-name>HttpMethodFilter</filter-name>
<filter-class>org.springframework.web.filter.HiddenHttpMethodFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>HttpMethodFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

3.JSP画面
<form action="" method="post">
<input type="hidden" name="_method" value="put" />
//some code
</form>

Java

Posted by arkgame