javaweb中,前臺向後臺提交多個同名(name)參數,後臺怎麼接受

SpringMVC中可以定義一個數組參數
@RequestMapping(value="/toTest")
public void toTest(HttpServletRequest request,String[] id) throws Exception {
System.out.println(id.length);
}

或者使用request內置對象
String[] id = request.getParameterValues("id");


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章