개발

Request Param으로 배열 처리

Domaya 2022. 12. 31. 16:58

https://kamsi76.tistory.com/entry/Spring-RequestParam%EC%9C%BC%EB%A1%9C-%EB%B0%B0%EC%97%B4-%EC%B2%98%EB%A6%AC

 

[Spring] RequestParam으로 배열 처리

- ajax로 보낼 경우@RequestParam(value="arr[]" String[] arr) - get 또는 post로 보낼 경우@RequestParam(value="arr" String[] arr)

kamsi76.tistory.com

 

뷰에서 여러 인풋을 만들어두고

그 인풋을 배열로 받아 백단에서 메일을 전송하려 한다

이를 배열로 받으려면

 

@RequestMapping(value = "/joinus/emailAuth", method = RequestMethod.POST)
public String emailAuth(@RequestParam(value="email[]") String[] email) {

다음과 같이 @RequestParam에서 배열을 설정해준다