第六周作业

<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
<style type="text/css">
textarea {
    overflow-y: auto;
}
 
#zc {
    background-color: aqua;
    width: 300px;
}
 
#bz {
    float: right;
}
 
.t {
    float: left;
    width: 120px;
    text-align: center;
    text-align-last: justify;
}
 
#y {
    width: 40px;
}
</style>
</head>
<body>
    <img src="img/bd.png">
    <div id="zc">
        <span id="yhzc">用户注册</span> <span id="bz"> <a id="">帮助</a>
        </span>
    </div>
    <form action="jies.jsp" method="post">
        <span class="t">用户名:</span> <input type="text" name="yhm" />只能输入字母或数字,4-16个字符
        <br /> <span class="t">密码:</span> <input type="password" name="mm" />密码长度6-12位
        <br /> <span class="t">确认密码:</span> <input type="password"
            name="qrmm" /> <br /> <span class="t">性别:</span> <input
            type="radio" name="xb" value="男" checked="checked" />男 <input
            type="radio" name="xb" value="女" />女 <br /> <span class="t">电子邮件地址:</span>
        <input type="email" name="dzyj" />请输入正确的Email地址 <br /> <span
            class="t">出生日期:</span> <input id="y" type="text" name="year" />年 <select
            name="month">
            <option value="1">一</option>
            <option value="2">二</option>
            <option value="3">三</option>
            <option value="4">四</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="4">5</option>
        </select>日 <br /> <input type="submit" value="同意以下协议条款并提交" />
    </form>
    <br>
    <textarea>协议条款内容</textarea>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
<style type="text/css">
.t {
    float: left;
    width: 120px;
    text-align: center;
    text-align-last: justify;
}
</style>
</head>
<body>
    <%
        request.setCharacterEncoding("utf-8");
        String yname = request.getParameter("yhm");
        String pw = request.getParameter("mm");
        String ysex = request.getParameter("xb");
        String em = request.getParameter("dzyj");
        String y = request.getParameter("year");
        String m = request.getParameter("month");
        String d = request.getParameter("day");
    %>
    <h1>您注册的信息如下:</h1>
    <span class="t">用户名:</span><%=yname%>
    <br />
    <span class="t">密码:</span><%=pw%>
    <br />
    <span class="t">性别:</span><%=ysex%>
    <br />
    <span class="t">电子邮件:</span><%=em%>
    <br />
    <span class="t">出生日期:</span><%=y%>年<%=m%>月<%=d%>日
    <br>
</body>
</html>

 

 

 

 

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>注册</title>

  </head>
  
  <body>
  <div>
   <form action="regist.jsp" >
  姓名: <input type="text" name="name"><br>
  性别: <input type="radio" name="sex" value="男" checked="ok"><input type="radio" name="sex" value="女">女<br>
  班级: <select name=grade>
  <option value="计算机1901">计算机1901
  <option value="计算机1902">计算机1902
  <option value="计算机1903">计算机1903
  <option value="计算机1904">计算机1904
  <option value="计算机1905">计算机1905
  </select>
  <br>
  数学:<input type="text" name="math"><br>
  语文:<input type="text" name="chinese"><br>
  英语:<input type="text" name="english"><br>
   <input type="submit" value="提交">
   <input type="reset" value="重置">
   </form>
   </div>
  </body>
</html>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>平均分</title>
  </head>
  
  <body>
  <h1>求平均分</h1>
  <%
  request.setCharacterEncoding("utf-8");
  String name=request.getParameter("name");
  String grade=request.getParameter("grade");
  String sex=request.getParameter("sex");
  String math=request.getParameter("math");
  String chinese=request.getParameter("chinese");
  String english=request.getParameter("english");
  
  double m=Integer.parseInt(math);
  double c=Integer.parseInt(chinese);
  double e=Integer.parseInt(english);
  double sum=(m+c+e)/3;
   %>
 你好!<%=grade %>班的<%=name %>同学<br>
 性别:<%=sex %><br>
 您的各科平均分为<%=sum %>

  </body>
</html>

 

posted @ 2022-04-10 14:14  潘雨  阅读(5)  评论(0编辑  收藏  举报