第六次作业

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

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
</head>

<body>
	<div align="center">
		<div align="center" style="width: 80% ;">
			<div align="center">
				<div style="float: left">
					<img src="img/baidu.png" width="150px" height="70px">   
				</div>
				<br>
				<div
					style="background-color: #DAEFF2 ; float: left;width: 80% ; margin-top:20px;">
					<span style="float: left;">用户注册</span><a href="#"
						style="float: right; ">帮助</a>
				</div>
			</div>
			<div style="float: right; margin-top:30px;margin-right:30px;">
				<a href="index.jsp">1.填写信息</a> <a href="index2.jsp">2.注册成功并激活空间</a>
			</div>
			<br><br><br>
			<form action="index2.jsp" method="post" style="margin-left:30px; margin-top:20px">
				<table style="float: left">
					<tr>
						<td>用户名:<br> <br></td>
						<td><input type="text" name="user" placeholder="张三四五六"/><br> <br>
						</td>
					</tr>

					<tr>
						<td>密码:<br> <br></td>
						<td><input type="password" name="password" placeholder="······"/><br> <br>
						</td>
					</tr>

					<tr>
						<td>确认密码<br> <br></td>
						<td><input type="password" name="password2" placeholder="······"/><br> <br>
						</td>
					</tr>

					<tr>
						<td>性别<br> <br></td>
						<td>
						<input type="radio" name="sex" value="男"/>男
					<input type="radio" name="sex" value="女" />女
						</td>
					</tr>

					<tr>
						<td>电子邮件<br> <br></td>
						<td><input type="email" name="email" placeholder="3031429037@qq.com"><br> <br>
						</td>
					</tr>
					<tr>

						<td>出生日期<br> <br></td>
						<td><input type="date" name="date" ><br> <br>
						</td>
					</tr>

					<tr>
						<td colspan="2" align="right"><input type="submit"
							value="同意以下协议条款并提交"> <br> <textarea cols="50"
								rows="10" style="float: left ;">
								计算机1904袁铭泽193230435;计算机1904袁铭泽193230435;计算机1904袁铭泽193230435;计算机1904袁铭泽193230435;计算机1904袁铭泽193230435;计算机1904袁铭泽193230435;计算机1904袁铭泽193230435;计算机1904袁铭泽193230435;计算机1904袁铭泽193230435;
            </textarea></td>
					</tr>
				</table>
			</form>


		</div>
	</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+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'index2.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

</head>

<body>
	<h1>您注册的信息如下</h1>
	<% 
  request.setCharacterEncoding("utf-8");
  String user=request.getParameter("user");
  String password=request.getParameter("password");
  String sex=request.getParameter("sex");
  String email=request.getParameter("email");
   String date=request.getParameter("date");
  %>
	用户名:<%=user %><br> 密码:<%=password %><br> 性别:<%=sex %><br>
	电子邮件:<%=email %><br> 出生日期:<%=date %>
	<br>
</body>
</html>

 

 

 

 

 

 

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>求平均值</title>
</head>
<body>
<h3>求平均值</h3>
<form action="Average.jsp" method="post">
    姓名:<input type="text" name="name"><br>
    性别:<input type="radio" name="sex" value="男">男<input type="radio" name="sex" value="女">女<br>
    班级:
    <select name="class">
        <option value="1903">1903</option>
        <option value="1904">1904</option>
        <option value="1905">1905</option>
    </select><br>
    语文:<input type="text" name="Chinese"><br>
    数学:<input type="text" name="Math"><br>
  
    <br>
    <input type="submit" value="提交"><br>
    <br>
</form>
</body>
</html>

  

 

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>平均值结果</title>
</head>
<body>
<%
    request.setCharacterEncoding("utf-8");
    String name = request.getParameter("name");
    String itClass = request.getParameter("class");
    String sex = request.getParameter("sex");
    String Chinese = request.getParameter("Chinese");
    String Math = request.getParameter("Math");
    
    double ChineseScore=Double.parseDouble(Chinese);
    double MathScore=Double.parseDouble(Math);
    
    double average=(ChineseScore+MathScore)/2;
%>
<h1>您好,<%=itClass%>的<%=name%>同学!</h1><br>
<br>
性别:<%=sex%><br>
您的各科平均分是:<%=average%><br>
</body>
</html>

  

 

 

 

posted @ 2022-04-10 05:54  樽梦  阅读(22)  评论(0编辑  收藏  举报