第六周作业

1.

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<html>
  <head>  
    <title>My JSP 'zhuce.jsp' starting page</title>    
  </head>  
  <body> 
   <div>
        <div style="float: left">
            <img alt="" src="image/baidu.png" width="150px" height="40px">   
        </div>
        <br>
        <div style="background-color: lightgreen ; float: left; " >
            用户注册             
                 
            <a href="#" >帮助</a>
            <br>
            
        </div>
        <br>
                        
            1.填写信息    2.注册成功并激活空间
            <br>
    <form action="zc.jsp" method="post">
    <br>
用户名:   <input type="text" name="uname">只能输入字母或数字:4-16个字符 <br>
密码:    <input type="password" name="upwd">密码长度6-12位<br>
确认密码:<input type="password" name="upwd"><br>  
 性别:        
  <input type="radio" name="sex" value="男"><input type="radio" name="sex" value="女"><br> 
电子邮件:
    <input type="text" name="email" > 请输入正确的Email地址<br>
出生日期:
  <input type="text" name="year" size=5>年  
  <select name="mouth" >
  <option value="1">一月</option>
   <option value="2">二月</option>
      <option value="3">三月</option>
        <option value="4">四月</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>
    </select><br>
        
    <input type="submit" value="同意以下协议条款并提交">
  
    </form>  
    <textarea cole="80" rows="10">用户须知:......</textarea>
  </body>
</html>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

<html>
  <head> 
    <title>My JSP 'zc.jsp' starting page</title>    
  </head>
  <body>   
  您注册的信息如下:<br>
  <%
  request.setCharacterEncoding("utf-8");
      String uname=request.getParameter("uname");
      String upwd=request.getParameter("upwd");  
      String sex=request.getParameter("sex");
      String email=request.getParameter("email");
      String year=request.getParameter("year");
      String mouth=request.getParameter("mouth");
      String day=request.getParameter("day");
   %>
你注册的用户名是:<%=uname %><br>
密码是:<%=upwd %><br>
性别是:<%=sex %><br>
邮箱是:<%=email %><br>
出生日期是:<%=year %>年- 
<%=mouth %>月-
<%=day %><br> 
  </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>
<center>
 <form action="sum.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="class1" >
  <option value="1">计算机1901</option>
    <option value="2">计算机1902</option>
      <option value="3">计算机1903</option>
    </select><br>
    <br>
语文:
<input type="text" name="yuwen" size=5 /><br>
<br>
数学:
<input type="text" name="shuxue" size=5 /><br>
<br>
英语: 
<input type="text" name="yingyu" size=5 /><br>
<br>   
<input type="submit" name="sumbit" value="提交"/>
<input type="submit" name="sumbit1" value="重置"/>      
    </form>  
    </center>
</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 yuwen=request.getParameter("yuwen");
  String shuxue=request.getParameter("shuxue");
   String yingyu=request.getParameter("yingyu");
   String uname=request.getParameter("uname"); 
      String sex=request.getParameter("sex");
      String class1=request.getParameter("class1"); 
   
        int yuwen1=Integer.parseInt(yuwen);
        int shuxue1=Integer.parseInt(shuxue);
        int yingyu1=Integer.parseInt(yingyu);
        double a=(yuwen1+shuxue1+yingyu1)/3.0;    
  %>
 您好!<%=class1 %>班的<%=uname %>同学!<br>
 性别:<%=sex %><br>
 您的各科平均分是:<%=a %>
 
</body>
</html>

 

 

 

 

posted @ 2022-04-08 14:28  冯雨心  阅读(9)  评论(0编辑  收藏  举报