編碼統(tǒng)一utf-8
文件名:e2alert.html
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Conten-Type" content="text/html; charset=UTF-8">
<title>登錄失敗</title>
</head>
<body>
<h1 align="center">
用戶(hù)名或密碼不正確!<br>
沒(méi)有登錄磁餐!無(wú)權(quán)訪(fǎng)問(wèn)本網(wǎng)站蓬痒!
</h1>
<h1 align="center"><a href="e2login.html">請(qǐng)登錄!</a></h1>
</body>
</html>
文件名:e2check_login.jsp
<%@ 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 name=request.getParameter("username");
String password=request.getParameter("passwd");
if(name.equals("admin") && password.equals("123"))
{
session.setAttribute("username",name);
response.sendRedirect("e2login_success.jsp");
}
else
{
%>
<jsp:forward page="e2alert.html"/>
<%
}
%>
</body>
</html>
文件名:e2login.html
<html>
<body>
<form method=post action="e2check_login.jsp">
<table align="center">
<tr>
<td>
用戶(hù)名:
</td>
<td>
<input type=text name="username">
</td>
</tr>
<tr>
<td>
密碼:
</td>
<td>
<input type=text name="passwd">
</td>
</tr>
<tr>
<td colspan=2 align="center">
<input type=submit value="登錄">
<input type=reset value="重設(shè)">
</td>
</tr>
</table>
</body>
</html>
文件名:e2login_success.jsp
<%@ 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">
<%@include file="e2session_check.jsp" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>登錄成功</title>
</head>
<body>
<br>
<hr width=380>
<center>
<h1>
<%
out.print(sename);
%>
登錄成功
</h1>
<h2>
歡迎您帜乞!<%=sename %>
</h2>
</center>
</body>
</html>
文件名:e2session_check.jsp
<%@ 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 sename=(String)session.getAttribute("username");
if(sename==null || !sename.equals("admin"))
{
response.sendRedirect("e2alert.html");
}
%>
</body>
</html>
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者