memo

[JAVA] BindingResult 을 가진 BindException 강제 발생

꿈꾸는토끼 2021. 7. 16. 11:20
 public String newsExecute(HttpServletRequest request, @Valid Table1 table1, BindingResult error) throws BindException {

        if(table1.getThumbnailFile().getSize()==0){
            error.addError(new ObjectError("thumnailPhoto","썸네일 사진이 없습니다."));
            throw new BindException(error);
            // ValidationUtils.rejectIfEmpty(error,"thumanailPhoto","MSG00001");
        }

 

윗대가리 부분만 잘라옴..

회사 코드라 조금 수정....

exception e안에 BindingResult가 원하는 형식으로 안들어가서(??) 이리저리.. 암튼메모..