11.24作业1

登陆页

<%@ 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="zuoye11.jsp" method="get" >

账号 <input name="zhanghao" type="text"  size="16" value="请输出账号"/><br><br>

密码 <input name="mima" type="password"  size="16" /><br>

&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp

<input name="tijiao" type="submit" value="提交"/>

&nbsp&nbsp&nbsp&nbsp

<input name="qvxiao" type="button" value="取消"/>

</form>

</body>
</html>

错误页 设置账号为123,密码为123。

<%@ 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 s1 = new String(request.getParameter("mima"));

String s2 = new String(request.getParameter("zhanghao"));

if(s1 != "123" || s2 != "123")
{
    out.print("您输入的账号和密码有错误");
}

response.setHeader("refresh","30;URL=zuoye1.jsp");

%>

</body>
</html>

 

原文地址:https://www.cnblogs.com/OldZhao/p/4993021.html