0
Spring MVCコントローラでPostパラメータを取得しようとしていますが、ServletRequestUtils getStringParametersメソッドがこのパラメータを検出できず、空の配列を返します。 ServletRequestUtilsで配列パラメータを取得する方法はありますか?Spring MVCコントローラでPostパラメータを取得するには?
マイコントローラ;
@ResponseBody
@RequestMapping(value = "/update", method = RequestMethod.POST)
public String update(HttpServletRequest request, HttpServletResponse response){
//I can get id parameter without problem.
String id = ServletRequestUtils.getStringParameter(request, "id", null);
String[] types = ServletRequestUtils.getStringParameters(request, "types");
}
My ajax post;
$.post("update", {
id: id,
types: types
....
}
私のフォームデータ。
id=2a4e905d-8015-447c-9d52-896042367c8a&types%5B%5D=IP+Num&types%5B%5D=Ver+Tab
のようなオプションにまだパラメータを見つけることができません。 – hellzone
申し訳ありませんが、私は答えを更新しました。今回はうまくいくと確信しています – neo
私の$ .postメソッドを$ .ajaxメソッドに更新しました。 – hellzone