【发布时间】:2016-09-18 11:54:08
【问题描述】:
问题是如果复选框未选中请求无法在springMVC控制器中找到正确的映射函数。因为似乎如果选中它只会发送真值,但如果不选中它不会发送假值.
<form action="editCustomer" method="post">
<input type="checkbox" name="checkboxName"/>
</form>
@RequestMapping(value = "/editCustomer" , method = RequestMethod. POST)
public void editCustomer(@RequestParam("checkboxName")String[] checkboxValue)
{
if(checkboxValue[0])
{
System.out.println("checkbox is checked");
}
else
{
System.out.println("checkbox is not checked");
}
}
【问题讨论】:
标签: html spring-mvc