배열로 정보를 받는 방법
<td style="text-align:right;"><input type="text" name="st_chicken_do" id="st_chicken_do<c:out value="${number}" />" value = "10" style="min-width:80px;width:80px;text-align:right;"></td>
이런 것들이 반복이 되는 상황이라면
request.getParameterValues
로 처리를 해야 하는데.. 배열
1.
import javax.servlet.http.HttpServletRequest;
public String insertDo(@ModelAttribute("vriStatVO") VriStatVO vriStatVO, ModelMap model, HttpServletRequest request) throws Exception {
String st_hanwoo_ho[] = request.getParameterValues("st_hanwoo_ho");
for(int idx=0; idx<st_hanwoo_ho.length; idx++){
System.out.println("한우===="+st_hanwoo_ho[idx]);
}
return "vri/ham/vriStat/save.tiles";
}
2.
/*컨트롤러부분
@RequestMapping(value = "/test", method = RequestMethod.POST)
public String updateTest
(@RequestParam(value = "num") String [] num,
@RequestParam(value = "value1") String [] value1,
@RequestParam(value = "value2") String [] value2
)
*/
이런 식으로 2가지 방법... 으로 할 수 있는 것 같다.
다른 방법도 있겠지만 잘 모름.