<body>
<form action="/servletdemo/servlet/Request2" method="post"> 用户名:<input type="text" name="username"><br/> 密码:<input type="password" name="password"><br/> 性别: <input type="radio" name="gender" value="mail">男 <input type="radio" name="gender" value="female">女<br/> 所在地: <select name="city"> <option value="beijing">北京</option> <option value="shanghai">上海</option> <option value="guangdong">广东</option> </select> <br/> 爱好: <input type="checkbox" name="likes" value="sing">唱歌 <input type="checkbox" name="likes" value="dance">跳舞<br/> 简介: <textarea rows="10" cols="10" name="description"></textarea> <br/> 大头照: <input type="file" name="photo"><br/> <input type="hidden" name="Id" value="123"><br/> <input type="submit" value="提交"><br/> </form> </body>
---------------------------------------------------------------------
System.out.println(request.getParameter("username"));
System.out.println(request.getParameter("city")); String[] ss=request.getParameterValues("likes"); for(int i=0;ss!=null && i<ss.length;i++){ System.out.println(ss[i]); } System.out.println(request.getParameter("Id")); }