第六次作业

.1.

 

 

 

 

doreg.jsp:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>注册界面</title>
</head>
<body>
 <form action="login.jsp" method="post">
  <br>  用户名:<input type="text" name="uname"> 只能输入字母或数字,4-16个字符<br>
   <br>  密码:<input type="password" name="upwd">密码长度6-12位<br>
    <br>   确认密码:<input type="password" name="upawd"><br>
 <br>   性别:
<input type="radio" name="sex" value="男">boy
<input type="radio" name="sex" value="女">girl<br>
  <br>  电子邮箱地址:<input type="email" name="uemail" value="257508192@qq.com">输入正确的Email地址<br>
    <br>出生日期:<input type="text" name="year"/><select name="month">
    <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>
    </select><select name="day">
    <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>
    <option value="13">13</option>
    <option value="14">14</option>
    <option value="15">15</option>
    <option value="16">16</option>
    <option value="17">17</option>
    <option value="18">18</option>
    <option value="19">19</option>
    <option value="20">20</option>
    <option value="21">21</option>
    <option value="22">22</option>
    <option value="23">23</option>
    <option value="24">24</option>
    <option value="25">25</option>
    <option value="26">26</option>
    <option value="27">27</option>
    <option value="28">28</option>
    <option value="29">29</option>
    <option value="30">30</option>
    </select><br>
  <br> <input type="submit" value="同意以下条款并提交" /><br>
    <textarea rows="10" cols="50" readonly="readonly">
    一、总则
   1.1 注册用户同意本协议的全部条款并完成注册程序,才能成为本系统的正式用户。请您仔细阅读本协议,您点击"同意"按钮后即表示完全接受本协议项下的全部条款。
   1.2 用户一旦注册,即视为用户确认自己具有享受本站服务的权利能力和行为能力,能够独立承担法律责任。
   1.3 在注册和使用本系统时,用户应了解相关法律法规,确知享有的权利和义务;应保证注册时提交的信息合法、真实、准确,并取得相应授权。
   
    </textarea>
    </form>
</body>
</html>
login.jsp:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>???????</title>
</head>
<body>
 注册成功 <br>
  <%
  request.setCharacterEncoding("utf-8");
      String uname=request.getParameter("uname");
      String upwd=request.getParameter("upwd");
      String upawd=request.getParameter("upawd");
      String sex=request.getParameter("sex");
      String uemail=request.getParameter("uemail");
      String year=request.getParameter("year");
      String month=request.getParameter("month");
      String day=request.getParameter("day");
   %>
    <%
    if(upwd.equals(upawd)){%>
    你注册的用户名是:<%=uname %><br>
密码是:<%=upwd %><br>
性别是:<%=sex %><br>
电子邮件地址:<%=uemail %><br>
出生日期:<%=year %><%=month %><%=day %><br>
   <%
    }else{
     %>
    两次不一致
    <% }%>
</body>
</html>

 

 

 

 

 

 

String  如何转int   int  a=Integer.parseIn(s);

 

NewFile1:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>主页面</title>
</head>
<body>
<form action="NewFile2.jsp"method="post">
  <br>求平均值:<br>
  <br> 姓名: <input type="text" name="uname"/><br>
  <br> 性别:<input type="radio" name="sex" value="男"/><input type="radio"name="sex"value="女"/><br>
   <br>班级:
   <select name="banji">
   <option value="计算机1901">1901</option>
   <option value="计算机1902">1902</option>
   <option value="计算机1903">1903</option>
   </select><br>
   <br>语文:
   <input type="text" name="yuwen"><br>
   <br>数学:
   <input type="text" name="shuxue"><br>
   <br>英语:
   <input type="text" name="english"><br>
  <br> <input type="submit" value="提交" >
   <input type="reset" value="重置" ><br>
    </form>
</body>
</html>

 

NewFile2:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>跳转页面</title>
</head>
<body>
 <% 
  request.setCharacterEncoding("utf-8");
      String uname=request.getParameter("uname");
      String banji=request.getParameter("banji");
      String sex=request.getParameter("sex");
      String yuwen=request.getParameter("yuwen");
      String shuxue=request.getParameter("shuxue");
      String english=request.getParameter("english");
      %>
      <% double y=Double.parseDouble(yuwen);
      int m=Integer.parseInt(yuwen);
      double x=Double.parseDouble(shuxue);
      double z=Double.parseDouble(english);
      double arg=(x+y+z)/3;
      %>
      你好!<%=banji %><%=uname %>同学!<br>
      性别:<%=sex %><br>
      您的各科平均分是:<%=arg %>
</body>
</html>

 

 

 

posted @ 2022-04-07 21:47  好多鱼好多鱼好剩余  阅读(21)  评论(0编辑  收藏  举报