第六周作业
1.
<body> <form action="two.jsp" method='post'> 用户名:    <input type='text' name='name' value="name" /> <br> 密码:        <input type='password' name='mima' value='mima'/><br> 确认密码:<input type="password" name='querenmima' value='mima'/><br> 性别:       <input type="radio" name="sex" checked="checked" value="男"/>boy <input type="radio" name="sex" value="女"/>girl<br> 电子邮件:<input type="text" name="dianziyoujian" value="1234@qq.com"/>请输入正确的Email地址<br> 出生日期:<input type="text" name="nian" value=""> 年<select name="yue"> <option value="一">一</option> <option value="二">二</option> <option value="三">三</option> </select> 月<select name="day"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> </select>日<br> <input type="submit" name="ok" value="同意以下条件"><br> <textarea rows="10" cols="50"></textarea> </form> </body>
<body> 注册为成功!您的信息为:<br> <% request.setCharacterEncoding("utf-8"); String name=request.getParameter("name"); String mima=request.getParameter("mima"); String sex=request.getParameter("sex"); String dianziyoujian=request.getParameter("dianziyoujian"); String nian=request.getParameter("nian"); String yue=request.getParameter("yue"); String day=request.getParameter("day"); %> 用户名是:<%=name%><br> 密码是:<%=mima %><br> 性别是:<%=sex %><br> 电子邮件是:<%=dianziyoujian %><br> 生日是:<%=nian %>年<%=yue %>月<%=day %>日<br> </body>
<body> 求平均值 <form action="index2.jsp" method="get"> <table> <tr> <td>姓名</td> <td><input type="text" name="user"/></td> </tr> <tr> <td>性别</td> <td><input type="radio" name="sex" value="男"/>男</td> <td><input type="radio" name="sex" value="女"/>女</td> </tr> <tr> <td>班级</td> <td><select name="bj"> <option value="1903">1903</option> <option value="1902">1902</option></select> </td> </tr> <tr> <td>语文</td> <td><input type="number" name="ch"/></td> </tr> <tr> <td>数学</td> <td><input type="number" name="ma"/></td> </tr> <tr> <td>英语</td> <td><input type="number" name="en"/></td> </tr> <tr> <td> <input type="submit" value="提交"/></td> <td><input type="reset" value="重置"/></td> </tr> </table> </form> </body>
<body> <% request.setCharacterEncoding("utf-8"); String user=request.getParameter("user"); String sex=request.getParameter("sex"); String bj=request.getParameter("bj"); String ch=request.getParameter("ch"); double c=ch==null?-1:Double.parseDouble(ch); String ma=request.getParameter("ma"); double m=ma==null?-1:Double.parseDouble(ma); String en=request.getParameter("en"); double e=en==null?-1:Double.parseDouble(en); double sum=c+m+e; double avg=sum/3; %> 你好!<%=bj %>班的<%=user %>同学!<br> 性别:<%=sex %><br> 您的各科平均分为<%=avg%> </body>