第六周作业

1.

<%@ page import="java.util.Date" %><% Date date; %><%--
  Created by IntelliJ IDEA.
  User: 11512
  Date: 2022/3/5
  Time: 15:52
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

  <head>
    <title></title>
  </head>
  <body >
  <form action="doreg.jsp" method="post">
      用户名:<input type="text" name="uname" minlength="4" maxlength="16"> 只能输入字母或者数字<br>
      密码:<input type="password" name="upwd" minlength="6" maxlength="12">密码长6-12位<br>
      密码:<input type="password" name="upwd" minlength="6" maxlength="12"><br>
      性别:
      <input type="radio" name="sex" value="男">男
      <input type="radio" name="sex" value="女">女<br>
     电子邮件地址 :<input type="text" name="yx"> <br>
      出生日期:<input type="text" name="nyear" >
     年
      <select name="nmonth">
          <option value="1">1月</option>
          <option value="2">2月</option>
          <option value="3">3月</option>
          <option value="4">4月</option>
          <option value="5">5月</option>
          <option value="6">6月</option>
          <option value="7">7月</option>
          <option value="8">8月</option>
          <option value="9">9月</option>
          <option value="10">10月</option>
          <option value="11">11月</option>
          <option value="12">12月</option>月<br>
          <h2></h2>
      </select>
          <select name="nday">
              <option value="1">1</option>
              <option value="2">2</option>
              <option value="3">3</option>
              <option value="4">4</option>
              <option value="5">5</option>
              <option value="6">6</option>
              <option value="7">7</option>
              <option value="8">8</option>
              <option value="9">9</option>
              <option value="10">10</option>
              <option value="11">11</option>
              <option value="12">12</option>日<br>
          </select>
      <br>
      <input type="submit" value="同意协议条款并提交"/><br>
      <textarea name="bz" rows="5" cols="50">第一题第一题第一题第一题第一题第一题第一题</textarea><br>
      <input type="submit" value="注册">
  </form>

  </body>
</html>
<%@ page import="java.util.Date" %><% Date date; %><%--
  Created by IntelliJ IDEA.
  User: 11512
  Date: 2022/3/5
  Time: 15:52
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

  <head>
    <title></title>
  </head>
  <body >
  注册成功<br>
  <%
    request.setCharacterEncoding("utf-8");
    String uname=request.getParameter("uname");
    String upwd=request.getParameter("upwd");
    String sex=request.getParameter("sex");
    String yx=request.getParameter("yx");
    String nyear=request.getParameter("nyear");
    String nmonth=request.getParameter("nmonth");
    String nday=request.getParameter("nday");
  %>

  你注册的用户名是:<%=uname %><br>
  密码是:<%=upwd %><br>
  性别是:<%=sex %><br>
  邮箱是:<%=yx %><br>
  出生日期是:<%=nyear %>年
  <%=nmonth %>月
  <%=nday %>日<br>
  </body>
</html>

 

 

 

 

 

 

 

 2.

<%--
  Created by IntelliJ IDEA.
  User: 11512
  Date: 2022/4/6
  Time: 14:02
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
  <head>
    <title>求平均值</title>
  </head>
  <body>
  <form action="dorge.jsp" method="post">
    姓名:<input type="text" name="uname"> <br>
    性别:
    <input type="radio" name="sex" value="男">男
    <input type="radio" name="sex" value="女">女<br>
    班级
    <select name="nclass">
      <option value="计算机1901">1901</option>
      <option value="计算机1902">1902</option>
    </select>
    <br>
    语文:<input type="text" name="yw"> <br>
    数学:<input type="text" name="sx"> <br>
    英语:<input type="text" name="yy"> <br>
    <input type="submit"  name="submit" value="提交"/>
    <input type="reset"  value="重置"/>
  </form>

  </body>
</html>
<%--
  Created by IntelliJ IDEA.
  User: 11512
  Date: 2022/4/6
  Time: 14:02
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
  <head>
    <title></title>
  </head>
  <body>
  <%
    request.setCharacterEncoding("utf-8");
    String uname=request.getParameter("uname");
    String sex=request.getParameter("sex");
    String nclass=request.getParameter("nclass");
    String sx=request.getParameter("sx");
    String yw=request.getParameter("yw");
    String yy=request.getParameter("yy");
  %>
  <%
    int a=Integer.parseInt(yw);
    int b=Integer.parseInt(sx);
    int c=Integer.parseInt(yy);
    double arg=(a+b+c)/3;
  %>


  你好!<%=nclass%>班的<%=uname %>同学<br>
  性别:<%=sex %><br>
  您的各科平均分是:<%=arg %>
  </body>
</html>

 

 

 

 

 

 

 

posted @ 2022-04-10 12:25  李芊  阅读(10)  评论(0编辑  收藏  举报