第一个页面,没写国际化,所以输入只能是字母,中文会产生乱码
sessiontest1.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" c>
<title>test</title>
</head>
<body>
<form method=post action="sessiontest2.jsp">
姓名:
<input type=text name="username" value="请出入名字">
<input type=submit value="下一步">
</form>
</body>
</html
sessiontest02.jsp
<%@ page c language="java" %>
<html>
<head>
<meta http-equiv="Content-Type" c>
<title>test</title>
</head>
<body>
<%String username = request.getParameter("username");
session.setAttribute("name",username);
%>
您好
<%=username%>
!您最想去的地方是
<form method=post action="sessiontest3.jsp">
<input type=text name="place" value="请输入地点">
<input type=submit value="下一步">
</form>
</body>
</html>
sessiontest3.jsp
<%@ page language="java" c
pageEncoding="GB18030"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" c>
<title>test</title>
</head>
<body>
<%
String place1 = request.getParameter("place");
session.setAttribute("p",place1);
%>
<%
String username = (String)session.getAttribute("name");
String place = request.getParameter("place");
%>
你好
<%= username%>!
<br>
最想去的地方是:
<br>
<%=place%>
<br>
你最爱的人是:
<p>
<form method=post action="sessiontest4.jsp">
<input type=text name="man" value="请输入姓名">
<p>
<input type=submit value="下一步">
</form>
</body>
</html>
sessiontest4.jsp
<%@ page language="java" c
pageEncoding="GB18030"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" c>
<title>test</title>
</head>
<body>
<%
String username = (String)session.getAttribute("name");
String place = (String)session.getAttribute("p");
String man = request.getParameter("man");
%>
<%=username%>
<br>
最想去的地方是:
<br>
<%=place%>
<br>
最爱的人是:
<br>
<%=man%>
</body>
</html>