【发布时间】:2015-01-27 19:29:18
【问题描述】:
我想在我的页面中使用 x-editable,我向 this document 学习。
html元素在这里:
<a href="#" id="displayName" name="displayName" data-type="text" data-pk="1" data-url="/candidates/updateDisplayName" data-title="Enter username" th:text="${displayName}">Click and input</a>
我的控制器是:
@RequestMapping(value = "/candidates/updateDisplayName", method = RequestMethod.POST)
public @ResponseBody String updateDisplayName(@RequestParam(value = "displayName") String displayName, HttpServletRequest request) {
System.out.println("Update display name");
System.out.println(displayName);
return "";
}
但是,我一次又一次地得到错误,错误信息是这样的:
{"timestamp":1417250586743,"status":400,"error":"Bad 请求","异常":"org.springframework.web.bind.MissingServletRequestParameterException","消息":"必填 字符串参数“displayName”不是 present","path":"/candidates/updateDisplayName"}
我知道这是由请求参数引起的,但不知道如何解决,有人可以帮忙吗?非常感谢。
【问题讨论】:
标签: java spring spring-mvc thymeleaf x-editable