@Greg Kopffがここに投稿した回答に基づいて、この質問を基にしたいと思います。
基本的に、私がやろうとしているのは、request.getParameterMap()メソッドによって返されたマップの内容を出力にダンプすることです。
次の奇妙なマップを出力として取得しています(その値は、文字列または文字列配列のオブジェクト参照のアドレスであると私は信じています)
{submit = [Ljava.lang.String; @ 1fe4169、color = [Ljava.lang.String; @ 178920a、
chek_games = [Ljava.lang.String; @ bbfa5c、foo = [Ljava.lang.String; @ 131de9b}
私は次のコードを試しました-
パブリッククラスCoffeeSelectはHttpServletを拡張します{
protected void doPost(HttpServletRequest req、HttpServletResponse resp)は、ServletException、IOException{をスローします
マップrequestParams=req.getParameterMap();
resp.getWriter()。println(requestParams);
}
}
以下は私のHTML<フォーム>です
<form action = "SelectCofee.Do" method = "post">
<select id = "coffe_color" name = "color">
<optionvalue="green">緑</option>
<optionvalue="red">赤</option>
<optionvalue="blue">青</option>
</ select>
<br/> <br/>
<input type = "checkbox" id = "chek_games" name = "chek_games" value = "chess" />
<input type = "checkbox" id = "chek_games" name = "chek_games" value = "badminton" />
<input type = "checkbox" id = "chek_games" name = "chek_games" value = "cricket" />
<input type = "hidden" id = "foo" name = "foo" value = "bar" />
<input type = "submit" name = "submit" value = "Submit" />
</ form>
これらのオブジェクト参照を尊重する方法、またはこのように表現する方法。ここで何かが足りませんか?