第六周作业

1.

<div>
  <h3>用户注册</h3>
  <a href="#">帮助</a>
  </div>
  <h2>注册账号</h2>
  <form action="user.jsp" method="post">
    <table>
        <tr>
         <td>用户名  :</td>
         <td><input type="text"name="name">只能输入字母或数字,4-16个字符</td>
        </tr>
        <tr>
         <td height="12">密码:</td>
         <td height="12"><input type="password" name="password">密码长度6-12位</td>
        </tr>
        <tr>
         <td height="12">确认密码:</td>
         <td height="12"><input type="password" name="password1">请确认密码</td>
        </tr>
        <tr>
         <td>性别:</td>
         <td>
         <input type="radio" name="sex" value="男" checked="ok"/>男
         <input type="radio" name="sex" value="女"/>女
         </td>
        </tr>
        <tr>
        <td>电子邮箱地址:</td>
        <td><input type="text" name="email"/>请输入正确的邮箱地址 </td>
        </tr>
        <tr>
        <td>出生日期:</td>
        <td>
        <select name="year">
        <option id="2001">2001</option>
        <option id="2002">2002</option>
        <option id="2003">2003</option>
        <option id="2004">2004</option>
        </select>年
         <select name="month">
        <option id="1">1</option>
        <option id="2">2</option>
        <option id="3">3</option>
        <option id="4">4</option>
        </select>月
         <select name="day">
        <option id="item1">1</option>
        <option id="item2">2</option>
        <option id="item3">3</option>
        <option id="item4">4</option>
        </select>日
        </td>
        </tr>
        <tr><td><input type="submit" value="同意以下条款并提交"/></td></tr>
</table>
<textarea>同意</textarea>
</form>
  

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<body>
    <% request.setCharacterEncoding("utf-8");
  String name= request.getParameter("name");
  String password = request.getParameter("password");
  String password1 = request.getParameter("password1");
  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 (password.equals(password1)) {
                 out.print("注册成功" + "<br>");
                 out.print("用户名是 :" + name + "<br>" + "密码是 :" + password + "<br>"
                         + "性别 :" + sex + "<br>" + "电子邮件 :" + email + "<br>"
                        + "出生日期 :" + year+"年"+month+"月"+day+"日" + "<br>");
             } else {
                 out.print("两次密码不一样!!");
            }%>
  
  </body>

  

 

 

 

 2.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
 
  </head>
   
  <body>
<form action="regist.jsp" method="post">
        用户名:<input type="text" name="uname" value="李傲">只能输入字母或数字,4-16个字符<br>
         密码: <input type="password" name="upw1" value="123456">密码长度为6-12位<br>
        确认密码: <input type="password" name="upw2" value="123456"><br>
         性别: <input
            type="radio" name="sex" value="男">男 <input
            type="radio" name="sex" checked="checked" value="女">女<br>
            电子邮件地址:<input type="text" name="email" value="267007102@qq.com"><br>
            出生日期: <select name="nian">
            <option value="2001">2001</option>
            <option value="2002">2002</option>
            <option value="2003">2003</option>
            <option value="2004">2004</option>
            <option value="2005">2005</option>
        </select>年
        <select name="yue">
            <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>
        </select>月
        <select name="ri">
            <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>
        </select>日
         <br>
 
       <input type="submit" value="同意协议条款并提交"/><br>
     <textarea name="nei" rows="5" cols="50">righiasjgksdjgfkdjgifj</textarea><br>
    </form>
  </body>
</html>

  

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  
<title>My JSP 'index.jsp' starting page</title>
 
  </head>
   
  <body>
 
    <%
    request.setCharacterEncoding("utf-8");
    String uname = request.getParameter("uname");
    String upw1 = request.getParameter("upw1");
    String upw2 = request.getParameter("upw2");
    String sex = request.getParameter("sex");
    String email = request.getParameter("email");
    String nian= request.getParameter("nian");
    String yue= request.getParameter("yue");
    String ri= request.getParameter("ri");
    if(upw1.equals(upw2)){
                out.print("注册成功!!!您的注册信息是");
                out.print("用户名是:"+uname+"</br>"+"密码是:"+upw1+"</br>"
                +"性别是:"+sex+"</br>"+"电子邮件是:"+email+"</br>"+"出生日期是:"+nian+"年"+yue+"月"+ri+"日"+"</br>");
            }
            else{
                out.print("两次密码不一样!");
            }
     
%>
 
     
  </body>
</html>

  

 

 

 

posted @ 2022-04-10 22:36  计算机1904李傲  阅读(3)  评论(0编辑  收藏  举报