第六周作业

1

 

 

 

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<html>
<head>
<title>My JSP 'index1.jsp' starting page</title>
</head>
<body>
     <form action="zhuce.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="2330964373@qq.com"><br>
            出生日期: <select name="nian">
            <option value="2000">2000</option>
            <option value="2001">2001</option>
            <option value="2002">2002</option>
            <option value="2003">2003</option>
            <option value="2004">2004</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>
             <option value="10">10</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>
            <option value="16">16</option>
            <option value="17">17</option>
        </select><br>
 
       <input type="submit" value="同意协议条款并提交"/><br>
     <textarea name="nei" rows="5" cols="50">用户协议!!!!</textarea><br>
    </form>
</body>
</html>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<html>
  <head>
    <title>My JSP 'zhuce.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>

 

 

 

 

2.

 

 

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<html>
<head>
<title>My JSP 'index1.jsp' starting page</title>
</head>
<body>
     <form action="zhuce.jsp" method="post">
        求平均值:</br>
        姓名:<input type="text" name="uname" /><br>
        性别:<input type="radio" name="sex" value ="男"/><input type="radio" name="sex" value ="女"/><br>
        班级:<select name = "cla">
        <option value="计算机1901">计算机1901</option>
        <option value="计算机1902">计算机1902</option>
        <option value="计算机1903">计算机1903</option>
        <option value="计算机1904">计算机1904</option>
        </select><br>
        数学:<input  type="number"  name="math" /></br>
        语文:<input  type="number"  name="chin" /></br>
        英语:<input  type="number"  name="eng" /></br>
        <input type="submit" value="提交"/>
        <input type="reset" value="重置"/>
    </form>
</body>
</html>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<html>
  <head>
    <title>My JSP 'zhuce.jsp' starting page</title>
  </head>
  
  <body>
 <%
request.setCharacterEncoding("utf-8");
       String uname=request.getParameter("uname");
       String sex=request.getParameter("sex");
       String cla=request.getParameter("cla");
      
       String math=request.getParameter("math");
       String chin=request.getParameter("chin");
       String eng=request.getParameter("eng");
       double  a=Double.parseDouble(math);
       double  b=Double.parseDouble(chin);
       double  c=Double.parseDouble(eng);
       double equi=(a+b+c)/3;
       out.print("你好!"+cla+""+uname+"同学!"+"</br>"+"性别:"+sex+"</br>"+
       "您的各科平均分数是:"+equi);
    %>
  </body>
</html>

 

 

 

posted @ 2022-04-10 12:22  ·梓清  阅读(11)  评论(0编辑  收藏  举报