1
我想在bindingresult haserror active時返回http錯誤或退出方法。我該怎麼辦?Spring MVC bindingresult haserror return
@RequestMapping(value = "/create", method = RequestMethod.POST)
public Node create(@Valid @RequestBody Node node, BindingResult bindingResult) {
LOG.info(String.format("Create new Node: %s", node));
if (!bindingResult.hasErrors()) {
return nodeService.create(node);
}
else{
// How i can exit without return any Node object ?
}
}
非常感謝,它沒有創建新節點時,有錯誤;) –
接受答案,如果它幫助,謝謝。 – mhshimul