<%@ 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 action="login_result.jsp"method="post">
<h1 align="center">用户登录</h1>
<table align="center">
<tr>
<td>用户名称:</td>
<td><input type="text" value="" name="id"/></td>
</tr>

<tr>
<td>用户密码:</td>
<td><input type="password" value="" name="pass"/></td>
</tr>
<tr>

<td><input type="reset" value="重置键"></td>
<td><input type="submit"></td>

</tr>
</table>
</form>

</body>
</html></html>
<%@ 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>

登录失败,请<a href="index.jsp" >重新登录</a>

</body>
</html>
<%--
Created by IntelliJ IDEA.
User: bin
Date: 2022/9/6
Time: 16:20
To change this template use File | Settings | File Templates.
--%>
<%@ 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>
<%
//1 获取页面上的登录信息
String id =request.getParameter("id");//获取账号
String pass = request.getParameter("pass");//获取密码

//2 登录验证(跟自己的QQ账号密码比,比死的:下去把自己的账号密码和文件中对比;后期跟数据库中对比,比活的)
if(id.equals("123") && pass.equals("1234")){
//登陆成功
response.sendRedirect("main.html");
}else{
%>
<jsp:forward page = "login2.jsp"></jsp:forward>

<%
}
%>

</body>
</html>
posted on 2022-09-11 14:50  Bot_noob  阅读(19)  评论(0编辑  收藏  举报