java_web/test03/web/login.jsp
2024-12-03 01:21:51 +08:00

50 lines
1.5 KiB
Plaintext

<%--
Created by IntelliJ IDEA.
User: 25589
Date: 2024/11/18
Time: 上午10:52
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>登录页面</title>
<link rel="stylesheet" href="${pageContext.request.contextPath}/css/login.css">
</head>
<body>
<form action="${pageContext.request.contextPath}/userAction">
<table class="login-table">
<tr>
<td colspan="2" style="background-color: #bbb">用户登录信息录入,<span style="color: red">*</span>为必填</td>
</tr>
<tr>
<td><label for="username">用户名</label></td>
<td><input type="text" name="username" id="username"></td>
</tr>
<tr>
<td><label for="password">密码</label></td>
<td><input type="password" name="password" id="password"></td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="登录" style="margin: auto"></td>
</tr>
</table>
</form>
</body>
<script>
<%
String loginFlag=request.getParameter("loginflag");
String username=request.getParameter("username");
if(loginFlag==null){ //无登录失败标识,是正常访问登录页面
loginFlag="";
}
if(loginFlag.equals("1")){
out.println("alert('用户【"+username+"】不存在!')");
}else if(loginFlag.equals("2")){
out.println("alert('密码错误!')");
}
%>
</script>
</html>