Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2b572e6

Browse files
committed
update
1 parent 2181df0 commit 2b572e6

18 files changed

+265
-0
lines changed

ch03/ch03_10/ch03_10_input.jsp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<%@ page contentType="text/html" import="java.util.*" pageEncoding="UTF-8"%>
2+
<html>
3+
<head>
4+
<title>输入页面</title>
5+
</head>
6+
<body>
7+
<form action="ch03_10_showInfo.jsp" method="post">
8+
数据1:<input type="text" name="shuju1"/><br/>
9+
数据2:<input type="text" name="shuju2"/><br/>
10+
<input type="submit" value="提交"/><br/>
11+
</form>
12+
</body>
13+
</html>

ch03/ch03_10/ch03_10_showInfo.jsp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<%@ page contentType="text/html" import="java.util.*" pageEncoding="UTF-8"%>
2+
<html>
3+
<head>
4+
<title>使用request对象获取客户端的有关信息</title>
5+
</head>
6+
<body>
7+
<font color="blue">表单提交的信息:</font><br/>
8+
输入的第一个数据是:<%=request.getParameter("shuju1") %><br/>
9+
输入的第二个数据是:<%=request.getParameter("shuju2") %><br/>
10+
<font color="red">客户端信息:</font><br/>
11+
客户端协议名和版本号:<%=request.getProtocol() %><br/>
12+
客户机名:<%=request.getRemoteHost() %><br/>
13+
客户机的IP地址:<%=request.getRemoteAddr() %><br/>
14+
客户提交信息的长度:<%=request.getContentLength() %><br/>
15+
客户提交信息的方式:<%=request.getMethod() %><br/>
16+
HTTP头文件中的Host值:<%=request.getHeader("Host") %><br/>
17+
服务器名:<%=request.getServerName() %><br/>
18+
服务器端口号:<%=request.getServerPort() %><br/>
19+
接受客户提交信息的页面:<%=request.getServletPath() %><br/>
20+
</body>
21+
</html>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<%@ page contentType="text/html" import="java.util.*" pageEncoding="UTF-8"%>
2+
<html>
3+
<head>
4+
<title>成功登入页面</title>
5+
</head>
6+
<body>
7+
<% String name = request.getParameter("RdName"); %>
8+
欢迎,<%=name %>成功登录!
9+
</body>
10+
</html>

ch03/ch03_11/ch03_11_userLogin.jsp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<%@ page contentType="text/html" import="java.util.*" pageEncoding="UTF-8"%>
2+
<html>
3+
<head>
4+
<title>提交页面</title>
5+
</head>
6+
<body>
7+
<form action="ch03_11_userReceive.jsp" method="post">
8+
姓名:<input type="text" name="RdName"><br>
9+
密码:<input type="password" name="RdPasswd"><br><br>
10+
<input type="submit" value="确定"><br>
11+
</form>
12+
</body>
13+
</html>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<%@ page contentType="text/html" import="java.util.*" pageEncoding="UTF-8"%>
2+
<html>
3+
<head>
4+
<title>验证页面</title>
5+
</head>
6+
<body>
7+
<%
8+
String name = request.getParameter("RdName");
9+
String password = request.getParameter("RdPasswd");
10+
if(!(name.equals("abcdef") && password.equals("123456"))) {
11+
response.sendRedirect("http://sohu.com");
12+
} else {%>
13+
<jsp:forward page="ch03_11_loginCorrect.jsp"></jsp:forward>
14+
<%} %>
15+
</body>
16+
</html>

ch03/ch03_12_time.jsp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<%@ page contentType="text/html" import="java.util.*" pageEncoding="UTF-8"%>
2+
<html>
3+
<head>
4+
<title>页面自动刷新时间</title>
5+
</head>
6+
<body>
7+
当前时间是:<%=new Date().toLocaleString() %><br>
8+
<hr>
9+
<% response.setHeader("refresh", "1"); %>
10+
</body>
11+
</html>

ch03/ch03_13_session.jsp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<%@ page contentType="text/html" import="java.util.*" pageEncoding="UTF-8"%>
2+
<html>
3+
<head>
4+
<title>利用session对象获取会话信息并显示</title>
5+
</head>
6+
<body>
7+
<hr>
8+
session的创建时间是:<%=new Date(session.getCreationTime()) %><br>
9+
session的Id号:<%=session.getId() %><br>
10+
客户最近一次访问时间是:
11+
<%=new java.sql.Time(session.getLastAccessedTime()) %><br>
12+
两次请求间隔多长时间session将被取消(ms):
13+
<%=session.getMaxInactiveInterval() %><br>
14+
是否是新创建的session:<%=session.isNew()?"" : "" %><br>
15+
<hr>
16+
</body>
17+
</html>

ch03/ch03_5/ch03_5_output.jsp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<%@ page contentType="text/html" pageEncoding="UTF-8"%>
2+
<html>
3+
<head>
4+
<title>接受参数页面</title>
5+
</head>
6+
<body>
7+
接受参数,并显示结果页面。<br/>
8+
<%String str=request.getParameter("userName"); %>
9+
<font color="blue" size="12"><%=str %></font>你好,欢迎你访问!
10+
</body>
11+
</html>

ch03/ch03_5/ch03_5_string.jsp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<%@ page contentType="text/html" pageEncoding="UTF-8"%>
2+
<html>
3+
<head>
4+
<title>传参数页面</title>
5+
</head>
6+
<body>
7+
<h4>该页面传递一个参数QQ,直线下是接受参数页面的内容</h4>
8+
<hr>
9+
<jsp:include page="ch03_5_output.jsp">
10+
<jsp:param value="QQ" name="userName"/>
11+
</jsp:include>
12+
</body>
13+
</html>

ch03/ch03_6/ch03_6_infoInput.jsp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<%@ page contentType="text/html" pageEncoding="UTF-8"%>
2+
<html>
3+
<head>
4+
<title>利用表单传递参数</title>
5+
</head>
6+
<body>
7+
<form action="ch03_6_infoReceive.jsp" method="post">
8+
姓名:<input name="rdName"/><br/>
9+
电话:<input name="phName"/><br/>
10+
<input type="submit" value="提交"/>
11+
</form>
12+
</body>
13+
</html>

0 commit comments

Comments
 (0)