在春季MVC验证中,错误消息的顺序随机更改,我希望消息按某种顺序排序!,
示例::按dto中的属性顺序。
DTO:
@NumberMaxLength(message = "{VLD023}", max = 10)
private String mainPrize;
@NumberMaxLength(message = "{VLD023}", max = 10)
private String distancePremium;
@NumberMaxLength(message = "{VLD023}", max = 10)
private String domesticOwnership;
控制器:
@PostMapping("/ACFB059004/edit")
public String editDividendRaceDo(@ModelAttribute("racePrizeDto") @Valid
RacePrizeDto dto, BindingResult result) {
if ( result.hasErrors() ) {
return "ACFB059004";
}
dividendRaceService.update(dto);
return "redirect:/ACFB059001";
}
jsp:
<form:errors path="*">
这可以解决吗?