JSP 第四次作业

<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
<style>
    .col {
        /* 设置显示为grad */
        display: grid;
        /* 默认显示为行 */
        grid-auto-flow: row;
        /* 修改为列显示 */
        grid-auto-flow: column;
        /* 显示为三行三列 */
        grid-template-columns: 100px 100px 100px;
        grid-template-rows: 200px 200px;
        /* 对于放不下的项目,会掩式生成单元格 */
        grid-auto-rows: auto;
    }


    input {

        font-size: inherit;
        text-align: left;
        vertical-align: top;
        horizontal-align: right;
    }
</style>
</head>
<body bgcolor=white>

<form action="info.jsp" method="post">
用户名: <input type="text" name="username" />
<br />
密码: <input type="password" name="password" />
<br />
确认密码: <input type="password" name="verify" />
<br />
性别:
<label><input name="gender" type="radio" value="male" />男</label> 
<label><input name="gender" type="radio" value="female" />女</label>
<br />
电子邮件: <input type="text" name="email" />
<br />
出生日期: <input type="text" name="year"/> 年 
<select name="month">
  <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>
  <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>
  <option value="11">11</option>
  <option value="12">12</option>
</select>
月
<input type="number" name="day" />
日
<br />

<button name="protocol">同意以下协议与提交</button>
<br />

<textarea rows=5 cols=20>test</textarea>

</form>


</body>

</html>
<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>

<meta charset="utf-8">
<title>Insert title here</title>
</head>
<body>
	<%
		request.setCharacterEncoding("utf-8");
		String username = request.getParameter("username");
		String password = request.getParameter("password");
		String gender = request.getParameter("gender");
		String email = request.getParameter("email");
		String birthday = request.getParameter("year") + "年" + request.getParameter("month") + "月" + request.getParameter("day") + "日";
	%>
	<label>您注册的信息如下:</label>
	<br/>
	<br/>
	<label>用户名: </label> <%= username %>
	<br/>
	<label>密码: </label> <%= password %>
	<br/>
	<label>性别: </label> <%= gender %>
	<br/>
	<label>电子邮件: </label> <%= email %>
	<br/>
	<label>出生日期: </label> <%= birthday %>
</body>
</html>


<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Average Start</title>
</head>
<body>
<label>求平均值: </label>
<form action="average_done.jsp" method="POST">
	姓名: <input type="text" name="name"><br/>
	
	性别: <label><input name="gender" type="radio" value="男" />男</label> 
	<label><input name="gender" type="radio" value="女" />女</label><br/>
	班级: <select name="class">
	<option value="01">01</option>
	<option value="02">02</option>
	</select></br>
	语文: <input name="chinese" type="number"><br/>
	数学: <input name="math" type="number"><br/>
	英语: <input name="english" type="number"><br/>
	<button>提交</button>
	<button>重置</button>
</form>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Average Done</title>
</head>
<body>
<%
	request.setCharacterEncoding("utf-8");
	String name = request.getParameter("name");
	String className = request.getParameter("class");
	String gender = request.getParameter("gender");
	String chinese = request.getParameter("chinese");
	String math = request.getParameter("math");
	String english = request.getParameter("english");
	double average = (Double.parseDouble(chinese) + Double.parseDouble(math) + Double.parseDouble(english)) / 3.0;
%>
<label>你好: <%= className %> 班的 <%= name %> 同学 </label><br/>
<label>性别: <%= gender %></label></br>
<label>您的平均成绩是: <%= average %></label><br/>

</body>
</html>


posted @ 2022-04-10 13:59  SuoJing  阅读(26)  评论(0编辑  收藏  举报