Spring MVC接受List Array Map參數
知識
10-10
後台代碼:
@RequestMapping(value = "test",method = RequestMethod.POST) public Response addList(@RequestParam(name = "testIds") List testIds,@RequestParam(name = "test2Ids") List test2Ids)throws Exception{ logger.info("TestController.addList testIds is {},test2Idsis {}",JSON.toJSONString(testIds),JSON.toJSONString(test2Ids));
return "test"; }
前端只需要傳用逗號分隔的字元串就可以。spring mvc會將其轉化成list
※外國程序員眼裡,中國程序員是怎麼樣的?老外:一群菜雞
※關於「編程的本質」的探討
TAG:程序員小新人學習 |