NewFile4.jsp
<%@ 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>
<form name="loginForm" action="NewFile5.jsp" method="post">
账号:<input name="account" type="text"><br>
密码:<input name="password" type ="password"><br>
<input type="button" value="登录" onclick="validate()">
</form>
<script type="text/javascript">
function validate(){
if(loginForm.account.value!=loginForm.password.value){
alert("登录失败");return;
}
loginForm.submit();
}
</script>
</body>
</html>
NewFile5.jsp
<%@ 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>
<%
String str=request.getParameter("account");
%>
<form action="NewFile6.jsp" method="post">
用户姓名:<input name="name" type="text"><br>
<input type="submit" value="提交">
<input name="account1" type="hidden" value="<%= str %>">
</form>
</body>
</html>
NewFile6.jsp
<%@ 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 str1=request.getParameter("account1");
String str2=request.getParameter("name");
out.println("用户账号:"+str1+"<br>"+"用户姓名:"+str2);
%>
</body>
</html>