11.24作业3

注册页

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>

<form action="zuoye33.jsp" method="get">

注册用户<br><br>

设置用户名 &nbsp;&nbsp;   <input name="yhm" type="text" size="16" /><br>

设置密码     &nbsp;&nbsp;&nbsp;&nbsp;   <input name="szmm" type="text" size="16" /><br>

确认密码    &nbsp;&nbsp;&nbsp;&nbsp;   <input name="qrmm" type="text" size="16" /><br>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;   <input type="submit" value="提交"> 
&nbsp;&nbsp;&nbsp;     <input type="button" value="关闭" onclick="window.close()">
 
</form>

</body>
</html>

中间页

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>

<%

String syhm = request.getParameter("yhm");

String sszmm = request.getParameter("szmm");

String sqrmm = request.getParameter("qrmm");

if(sszmm.equals(sqrmm))
{
    application.setAttribute("syhm", syhm);

    application.setAttribute("sszmm", sszmm);

    out.print("注册成功!");
}
else
{
    out.print("您输入的密码不一致!");
}

%>
<input type="button" value="查看注册信息" onclick="window.open('zuoye333.jsp')">


</body>
</html>

查看页

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<%

String syhm = new String(application.getAttribute("syhm").toString());

String sszmm = new String(application.getAttribute("sszmm").toString());

out.print("用户名:" + syhm +"<br>" + "密码:" + sszmm);

%>

</body>
</html>
原文地址:https://www.cnblogs.com/OldZhao/p/4994056.html