<form action="add" method ="post">
用户名:<input type="text" name="name"><br/>
性别:<input type="radio" value="male" name="sex" checked/>男
<input type="radio" value="female" name="sex" checked/>女<br/>
学历:<select name="xueli" multiple="multiple">
<option value="中学">中学</option>
<option value="大学">大学</option>
<option value="小学">小学</option>
</select><br/>
爱好:<input type="checkbox" value="music" name="hobbies"/>音乐
<input type="checkbox" value="football" name="hobbies"/>足球
<input type="checkbox" value="basketball" name="hobbies"/>篮球<br/>
自我介绍:<textarea rows="10" cols="60" name="introduce"></textarea><br/>
<input type="submit" value="提交">
</form>
add为servlet名称
post为提交方式
multiple为可多选
dopost,doget中取值:
String[] hobbies = req.getParameterValues(""hobbies);
for(String str:hobbies){
System.out.print(str+",");
}
System.out.printIn();