본문 바로가기
Today I learned

VIew에서 파라미터를 전달할때 Controller에서 Map으로 넘기는 방법

by soheemon 2019. 3. 21.

Form데이터를 Map으로 받아서 넘기는 방법-

RequestParam과 Model을 사용한다.


//View1

<form action="test">

<input type="text" name="V1">

<input type="text" name="V2">


<input type="submit">

</form>


//Controller

@RequestMapper(value="/test")

public String testMethod(@RequestParam Map map, Model model) {

model.addAttribute("AttributeName", map);

return "NextPage";

}


//NextPage.jsp

${AttributeName.V1}

${AttributeName.V2}


댓글