//以下是HTML textbox radioButton 和select textarea
<form action="UserServlet" method="post">姓名:<input
name="userName" Type="text"> <br>
<br>
性别:<input type="radio" name="sex" value="男" checked> 男 <input
type="radio" name="sex" value="女">女 <br>
<br>
生日:<input name="birthday" Type="text"> <br>
<br>
邮件:<input name="email" Type="text"> <br>
<br>
手机:<input name="phone" Type="text"> <br>
<br>
爱好: <input type="checkBox" name="favourites" value="游泳">游泳
<input type="checkBox" name="favourites" value="跑步">跑步
<input type="checkBox" name="favourites" value="爬山">爬山
<input type="checkBox" name="favourites" value="跳舞">跳舞 <br>
下拉框 爱好: <select name="favourite">
<option >游泳</option>
<option>爬山</option>
<option>跳舞</option>
<option>跑步</option>
</select>
<br>
地址:<textarea name="note" >efwef</textarea>
<input Type="submit" ,name="submit" ,value="提交">
</form>
//以下是对应的servlet:
String userName=request.getParameter("userName");
String sex=request.getParameter("sex");
String birthday=request.getParameter("birthday");
String email=request.getParameter("email");
String phone=request.getParameter("phone");
String favourites[]=request.getParameterValues("favourites");
String favourite=request.getParameter("favourite");
String note=request.getParameter("note");
response.getWriter().write(userName+"<br>");
response.getWriter().write(sex+"<br>");
response.getWriter().write(birthday+"<br>");
response.getWriter().write(email+"<br>");
response.getWriter().write(phone+"<br>");
if(favourites !=null)
{
for (int i=0;i<favourites.length;i++)
{
response.getWriter().write(favourites[i]);
}
}
response.getWriter().write("<br>"+favourite+"<br>");
response.getWriter().write(note+"<br>");