主界面
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<meta charset="UTF-8">
<title>登录界面</title>
</head>
<body bgcolor="#faebd7">
<form action ="leet.jsp" method="post">
<table border ="1" width="30%" align="center">
<tr>
<td>用户名:</td>
<td><input name ="uname" type="text"></td>
</tr>
<tr>
<td>密码:</td>
<td><input type="password" name="upwd"></td>
</tr>
<tr align ="center">
<td><button type="submit">登录</button> </td>
<td><input type="reset" value="重置" /></td>
</tr>
</table>
</form>
</body>
</html>
次界面
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%
request.setCharacterEncoding("utf-8");
String username=request.getParameter("uname");
String userpwd=request.getParameter("upwd");
if(username.equals("孤独求败")&&userpwd.equals("123456")) {
out.println(String.format("用户:%s,密码为:%s,登录成功!", username, userpwd));
}
else {
out.println("用户登录失败");
}
%>