jsp第六次作业

 1 <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
 2 <%
 3 String path = request.getContextPath();
 4 String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
 5 %>
 6 
 7 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 8 <html>
 9   <head>
10    
11   </head>
12   
13 <body>
14      <img style="width: 100px; height: 40px; margin-right: 100px"
15         src="https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png">
16     <div style="display: inline; background-color: aquamarine;">
17         <strong style="margin: 0px 400px 0px 0px;">用户注册</strong>
18         <a href="#">帮助</a>
19     </div>
20     <div>
21         <form action="index.jsp" method="post">
22             <table border="0" cellspacing="10" cellpadding="10">
23                 <tr>
24                     <td>用户名:</td>
25                     <td><input type="text" name="name" value="张三">只能输入字母或数字,4-16个字符</td>
26                 </tr>
27                 <tr>
28                     <td>密码:</td>
29                     <td><input type="password" name="password" value="123456">密码长度6-12位</td>
30                 </tr>
31                 <tr>
32                     <td>确认密码:</td>
33                     <td><input type="password" value="123456">
34                     </td>
35                 </tr>
36                 <tr>
37                     <td>性别:</td>
38                     <td><input type="radio" name="sex" value="男" checked="checked" />男<input
39                         type="radio" name="sex" value="女" />女</td>
40                 </tr>
41                 <tr>
42                     <td>电子邮箱地址:</td>
43                     <td><input type="email" name="email" value="1234567@qq.com">
44                     </td>
45                 </tr>
46                 <tr>
47                     <td>出生日期</td>
48                     <td><select name="year">
49                             <option value="1999">1999</option>
50                             <option value="2000">2000</option>
51                     </select>年 <select name="month">
52                             <option value="01">01</option>
53                             <option value="02">02</option>
54                     </select>月 <select name="day">
55                             <option value="01">01</option>
56                             <option value="02">02</option>
57                     </select>日</td>
58                 </tr>
59             <tr>
60                         <td></td>
61                         <td><input type="submit" value="同意以下协议条款并提交" /></td>
62                     </tr>
63                 </table>
64                 <textarea rows="5" cols="60">协议条款如下:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd</textarea>
65             </form>
66     </div>
67 </body>
68 </html>
 1 <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
 2 <%
 3 request.setCharacterEncoding("utf-8");
 4 String name = request.getParameter("name");
 5 String password = request.getParameter("password");
 6 String sex = request.getParameter("sex");
 7 String email = request.getParameter("email");
 8 int year=Integer.parseInt(request.getParameter("year"));
 9 int month=Integer.parseInt(request.getParameter("month"));
10 int day=Integer.parseInt(request.getParameter("day"));
11  %>
12 <!DOCTYPE html>
13 <html>
14 <head>
15 <meta charset="utf-8">
16 <title></title>
17 </head>
18 <body>
19       <h2>您注册的信息如下:</h2>
20       用户名:<%=name %><br>
21       密码:<%=password %><br>
22       性别:<%=sex %><br>
23       电子邮箱:<%=email %><br>
24       出生日期:<%=year %>年<%=month %>月<%=day %>25   </body>
26 </html>

 1 <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
 2 <!DOCTYPE html>
 3 <html>
 4 <head>
 5 <meta charset="utf-8">
 6 <title></title>
 7 </head>
 8     <form action="index.jsp" method="post">
 9         求平均值:<br> 姓名:<input type="text" name="uname" /><br> 性别:<input
10             type="radio" name="sex" value="男" checked="checked" />男 <input
11             type="radio" name="sex" value="女" />女<br> 班级:<select
12             name="class">
13             <option value="计算机1904">计算机1904</option>
14             <option value="计算机1905">计算机1905</option>
15         </select><br> 语文:<input type="text" name="chinese" /><br> 数学:<input
16             type="text" name="math" /><br> 英语:<input type="text"
17             name="english" /><br> <input type="submit" value="提交" /> <input
18             type="reset" value="重置" />
19     </form>
20 </html>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
    <%
        request.setCharacterEncoding("utf-8");
        String name = request.getParameter("uname");
        String sex = request.getParameter("sex");
        String cla = request.getParameter("class");
        String chinese = request.getParameter("chinese");
        String math = request.getParameter("math");
        String english = request.getParameter("english");
        double x = Double.parseDouble(chinese);
        double y = Double.parseDouble(math);
        double z = Double.parseDouble(english);
        double ave = (x + y + z) / 3;
        out.print("您好!" + cla + "的" + name + "同学!" + "<br>" + "性别:" + sex
                + "<br>" + "您各科的平均分数是:" + ave);
    %>
</body>
</html>

 

posted @ 2022-04-10 13:29  计算机1905geng  阅读(18)  评论(0编辑  收藏  举报