required string parameter1 @RequestParam(required = false) @RequestParam(value = "name", required = false) String name, Model model 더보기더보기참고@RequestParamSpring MVC에서 쿼리 스트링 정보를 쉽게 가져오는데 사용할 수 있다. @RequestParam이 적용된 필드가 없으면 Bad Request, Required String parameter 'name' is not present 라는 예외를 발생시킨다. 기본 요청 : http://localhost:8080/hello-mvc?name=이름required = false는 http://localhost:8080/hello-mvc 여기까지만 넣어도 가능하게 해준다.(default가 true이니까 원래는 뒤에 파라미터를 넣지 않으면 오류) 2024. 12. 17. 이전 1 다음