如何在JSP Spring MVC中按DTO中的属性顺序排列错误消息?

时间:2018-12-27 02:54:35

标签: java spring jsp

在春季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="*">

这可以解决吗?

0 个答案:

没有答案