第四次作业

1.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
        
  </head>
  
  <body>
  <form action="J.jsp" >
  用  户  名: <input type="text" name="uname">只能输入字母或数字,4-16个字符<br>
  密  码:<input type="password" name="pas1" minlength="6" maxlength="12"/>密码长度6-12位<br>
  确 认 密 码:<input type="password" name="pas2" minlength="6" maxlength="12"/><br>
  性别:<input type="radio" name="sex" value="男"><input type="radio" name="sex" value="女"><br>
  电子邮件: <input type="text" name="email">输入正确的Email地址<br>
  出生日期: <select name=year>
  <option value="1999">1999
  <option value="2000">2000
  <option value="2001">2001
  <option value="2001">2002
  </select><select name=month>
  <option value="1">1
  <option value="2">2
  <option value="3">3
  <option value="4">4
  <option value="5">5
  <option value="6">6
  <option value="7">7
  <option value="8">8
  <option value="9">9
  <option value="10">10
  <option value="11">11
  <option value="12">12
  </select><select name=day>
  <option value="1">1
  <option value="2">2
  <option value="3">3
  <option value="4">4
  <option value="5">5
  <option value="6">6
  <option value="7">7
  <option value="8">8
  <option value="9">9
  <option value="10">10
  <option value="11">11
  <option value="12">12
  <option value="1">13
  <option value="2">14
  <option value="3">15
  <option value="4">16
  <option value="5">17
  <option value="6">18
  <option value="7">19
  <option value="8">20
  <option value="9">21
  <option value="10">22
  <option value="11">23
  <option value="12">24
  <option value="1">25
  <option value="2">26
  <option value="3">27
  <option value="4">28
  <option value="5">29
  <option value="6">30
  <option value="7">31
  </select><br>
   <input type="submit" value="同意以下协议条款并提交"><br>
   <textarea rows="10" cols="40">协议条款</textarea>
   </form>
  </body>
</html>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
        
  </head>
  
  <body>
  <%
  request.setCharacterEncoding("utf-8");
  String uname=request.getParameter("uname");
  String password1=request.getParameter("pas1");
  String password2=request.getParameter("pas2");
  String sex=request.getParameter("sex");
  String email=request.getParameter("email");
  String year=request.getParameter("year");
  String month=request.getParameter("month");
  String day=request.getParameter("day");
   %>
   <%
    if(password1.equals(password2)){%>
    您注册的用户信息如下:<br>
  <br><br>
    用户名:<%=uname %><br>
    密码:<%=password1 %><br>
    性别:<%=sex %><br>
    电子邮件:<%=email %><br>
    出生日期:<%=year %><%=month %><%=day %><br>
   <%
    }else{
     %>
    两次密码不一致
    <% }%>

  </body>
</html>

2.

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
        
  </head>
  
  <body>
  <form action="index.jsp" >
  姓名: <input type="text" name="uname"><br>
  性别: <input type="radio" name="sex" value="男"><input type="radio" name="sex" value="女"><br>
  班级: <select name=grade>
  <option value="1901">1901
  <option value="1902">1902
  <option value="1903">1903
  <option value="1904">1904
  </select>
  <br>
  数学:<input type="text" name="math"><br>
  语文:<input type="text" name="chinese"><br>
  英语:<input type="text" name="english"><br>
   <input type="submit" value="提交">
   <input type="reset" value="重置">
   </form>
  </body>
</html>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
        
  </head>
  
  <body>
  <%
  request.setCharacterEncoding("UTF-8");
  String uname=request.getParameter("uname");
  String grade=request.getParameter("grade");
  String sex=request.getParameter("sex");
  String math=request.getParameter("math");
  String chinese=request.getParameter("chinese");
  String english=request.getParameter("english");
  
  double m=Integer.parseInt(math);
  double c=Integer.parseInt(chinese);
  double e=Integer.parseInt(english);
  double sum=(m+c+e)/3;
   %>
 你好!<%=grade %>班的<%=uname %>同学<br>
 性别:<%=sex %><br>
 您的各科平均分为<%=sum %>
 
  </body>
</html>

 

posted @ 2022-04-06 21:49  njztmx  阅读(17)  评论(0编辑  收藏  举报