jsp第次6作业
1.
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
<%@ 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=" 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="aaa123/><br> <br> </td> </tr> <tr> <td>确认密码<br> <br></td> <td><input type="password" name="password2" placeholder="aaa123"/><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 ;"> </textarea></td> </tr> </table> </form> </div> </div> </body></html> |
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
<%@ 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> |


2.
<%@ 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>
</head>
<body>
<form action="index2.jsp" method="post">
求平均值:<br> 姓名:<input type="text" name="name"><br> 性别:<input
type="radio" name="sex" checked="checked" value="boy">男 <input
type="radio" name="sex" value="girl">女<br>
班级:<select name="banji">
<option value="1">1932301</option>
<option value="2">1932302</option>
</select><br>
语文:<input type="text" name="yu">
<br>
数学:<input type="text" name="shu">
<br>
英语:<input type="text" name="ying">
<br>
<input type="submit" value="提交">
<input type="reset" value="重置">
</form>
</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 'two.jsp' starting page</title>
</head>
<body>
<%
request.setCharacterEncoding("utf-8");
String name=request.getParameter("name");
String sex=request.getParameter("sex");
String banji=request.getParameter("banji");
String yu=request.getParameter("yu");
String shu=request.getParameter("shu");
String ying=request.getParameter("ying");
double a=Integer.parseInt(yu);
double b=Integer.parseInt(shu);
double c=Integer.parseInt(ying);
double d=(a+b+c)/3;
%>
你好!<%=banji%>班的<%=name %>同学!<br>
性别:<%=sex %><br>
您各科平均分是:<%=d %>
</body>
<ml>




浙公网安备 33010602011771号