单行文本框
用户姓名:<input type="text" name="username" id="username" style="width:138px" /><br/>
用户密码:<input type="password" name="password" id="password" style="width:138px" /><br/>
<!--单选框-->
性别:<input type="radio" name="sex" value="male" checked/>男
<input type="radio" name="sex" value="female" />女
<br/>
爱好:<input type="checkBox" name="hobby" value="squash" />打壁球
<input type="checkBox" name="hobby" value="onlineGame" checked />网游
<input type="checkBox" name="hobby" value="movie" />电影
<input type="checkBox" name="hobby" value="music" />音乐
<br/>
<!--下拉列表框-->
国籍:<select name="nation">
<option>=====please choose=====</option>
<option selected>China PR</option>
<option>Japan</option>
<option>USA</option>
</select>
<br/>
<!--多行文本输入域-->
自我介绍:<textarea cols="10" rows="3" name="myself">输入内容不得超过140个字</textarea>
<br/>
<!--上传输入域-->
上传图片:<input type="file" name="pic" />
<br/>
<input type="image" name="image/1.jpg" />
<br/>
<input type="submit" value="登录" />
<input type="reset" value="注册" />
追问
中的 id 和name 怎么区分? 谢谢
追答id大多数用于标识这个组件,大多数用于css样式里面,而name大多数用于向后台传值,比如第一个输入框
当把输入后的内容传到后台时,就可以调用request,getParameter("username")来获取输入的值,request是方法中的一个参数
本回答被提问者采纳