1.login_main.jsp
`<%@ page language=“java” contentType=“text/html; charset=UTF-8”
pageEncoding=“UTF-8”%>
用户密码 :
` 2.login_dologin.jsp
<%@ 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>
<%
request.setCharacterEncoding("utf-8");
String name = request.getParameter("userName");
String psw = request.getParameter("password");
if("admin".equals(name)&& "123456".equals(psw)){
%>
<jsp:forward page="login_success.jsp"></jsp:forward>
<%
}
else{
%>
<jsp:forward page="login_error.jsp"></jsp:forward>
<%
}
%>
</body>
</html>
3.login_top.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<img alt="" src="image/top.jpg">
<br/>
4.login_bottom.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<p>
××××××信息工程系!@2007<br/>
学校地址:×××××××<br/>
电话:××××××× 电子邮件:××××@126.com</p>
5.login_success.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>成功页面</title>
</head>
<body>
<%
String str = request.getParameter("userName");
%>
用户:<%= str %>
登录成功<br/>
</body>
</html>
6.login.error.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>错误页面</title>
</head>
<body>
<p>登录失败</p><br/>
<a href="login_main.jsp">重新登录</a>
</body>
</html>
在该例中,用户名为admin,用户密码为123456时登录成功,否则登陆失败