728x90
반응형

Required request parameter 'xxx' for method parameter type String is not present 에러 발생 원인

Controller에서 Prameter 값을 받아올 때 null이거나 Type이 맞지 않는 경우 발생

 


해결 방법

@RequestParam의 required 속성을 false로 설정하거나 null 을 받아오면 안되는 경우 파라미터로 넘겨주는 값을 확인해보기

@RequestParam의 required 속성은 default true임

 

예시

public List<SampleDto> getSampleList(@RequestParam(value="customerNo", required=false) String customerNo) throws Exception {
    return sampleService.getSampleList(customerNo);
}
반응형
복사했습니다!