⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 login.jsp

📁 一个用jsp完成的医院管理系统,比较适合初学者参考着学习
💻 JSP
字号:
<%@ page contentType="text/html; charset=gbk"%><%@ include file = "../include/ccs.inc" %>
<%@ page import="hospital.db.dboperation.*" %>
<%@ page import="hospital.db.*" %>
<%@ page import="java.sql.*" %>
<%@ include file = "../include/ccs.inc" %>

<html>
<head>
<title>医院门诊预约系统-患者-登录</title>
<%
String _login="";
Patient p=(Patient)session.getAttribute("patient");
if(p!=null)
	_login="已登录";

if(request.getParameter("login")!=null){
	String username=request.getParameter("username");
	String password=request.getParameter("password");

	try{
		p=new Patient(username);
		int l=p.login(password);

		switch(l){
			case 1:
				_login="登录成功";
				session.setAttribute("patient",p);
				response.sendRedirect("../default.jsp");
				break;
			case 2:
				_login="密码错";
				break;
			case -1:
				_login="数据库异常";
				break;
			default:
				_login="一般异常";
		}
	}
	catch(InvalidUserException iue){
		_login="非法用户名";
	}
}
%>
</head>

<body bgcolor="#FFFFFF">
<table width="770" height="423" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#000000">
	<tr>
		<td height="421" bgcolor="#FFFFFF">
			<%@ include file = "../include/head.inc" %>
			<table width="770" height="290" border="0" align="center" cellpadding="0" cellspacing="0">
				<tr>
					<%@ include file = "../include/patient.inc" %>
					<td width="603" align="center" valign="top">
						<table width="100%" height="85%" border="0" cellpadding="3" cellspacing="1" bgcolor="#666666">
							<tr>
								<td width="488" height="257" align="center" valign="top" bgcolor="E3EDFF"><br>
									<p><strong><%=_login%></strong></p>
									<form action="login.jsp?login=true" method="post" name="login" id="login">
									<p>用户名:<input type="text" name="username"/></p>
									<p>密码:<input type="password" name="password"/></p>
									<p><input type="submit" value="登录" name="login" /></p>
									</form>
								</td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
		</td>
	</tr>
</table>
</body>
</html>
<%
if(p!=null)
	p.closeConnection();
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -