springboot_validation : typeMismatch
This commit is contained in:
@@ -144,6 +144,10 @@ public class ValidationItemControllerV2 {
|
||||
@PostMapping("/add")
|
||||
public String addItemV4(@ModelAttribute Item item, BindingResult bindingResult, RedirectAttributes redirectAttributes, Model model) {
|
||||
|
||||
if (bindingResult.hasErrors()) {
|
||||
return "validation/v2/addForm";
|
||||
}
|
||||
|
||||
// 검증 로직
|
||||
ValidationUtils.rejectIfEmptyOrWhitespace(bindingResult, "itemName", "required");
|
||||
// if (!StringUtils.hasText(item.getItemName())) {
|
||||
|
||||
@@ -32,4 +32,8 @@ max.java.lang.Integer = {0} 까지의 숫자를 허용합니다.
|
||||
required = 필수 값 입니다.
|
||||
min= {0} 이상이어야 합니다.
|
||||
range= {0} ~ {1} 범위를 허용합니다.
|
||||
max= {0} 까지 허용합니다.
|
||||
max= {0} 까지 허용합니다.
|
||||
|
||||
#추가
|
||||
typeMismatch.java.lang.Integer=숫자를 입력해주세요.
|
||||
typeMismatch=타입 오류입니다.
|
||||
Reference in New Issue
Block a user