📄 login.jsp
字号:
<%@ page contentType="text/html; charset=gb2312" errorPage="" %>
<%@ page import="java.sql.*,sms.db.*,sms.bean.*"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%
request.setCharacterEncoding("gb2312");
String commitFlag = (String)request.getParameter("submintButton");//得到按钮事件
String studentId = request.getParameter("studentId");
String pwd = request.getParameter("pwd");
StudentBean studentBean = null;
if(commitFlag != null){//如果单击了确定按钮
StudentBean studentBean2 = new StudentBean();
studentBean = studentBean2.queryStuInfo(studentId,pwd);//查询是否存在该学生信息
if(studentBean != null){//如果存在该学生信息
session.setAttribute("studentBean",studentBean);//将代表该学生信息的Bean保存在session中
RequestDispatcher dispatcher = request.getRequestDispatcher("/loginSuccess.jsp");
dispatcher.forward(request,response);
}
else{//调用脚本语言提示
%>
<script language="javascript" type="">
alert('请检查学号,密码是否正确!');
</script>
<%
}
}
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>登录</title>
<style type="text/css"></style>
<link href="css/style.css" rel="stylesheet" type="text/css">
<style type="text/css">
.style1 {font-family: "华文中宋"}
body {
background-color: #CCCCCC;
}
body,td,th {
color: #330066;
}
</style>
</head>
<body>
<table width="99%" border="0">
<tr>
<td height="71" colspan="3"><h1>请您先登录系统</h1></td>
</tr>
<tr>
<td width="13%" height="203"> </td>
<td width="42%">
<form action="login.jsp" method="post" name="form1">
<input type=hidden name="commitFlag" value="submit">
<table width="100%" border="0">
<tr>
<td width="46%" height="56" align="right"><span class="style2">学号:</span></td>
<td width="54%"><input name="studentId" type="text" class="text1" size="10" maxlength="10"></td>
</tr>
<tr>
<td height="47" align="right"><span class="style2">密码: </span></td>
<td><input name="pwd" type="password" class="text1" size="10" maxlength="10"></td>
</tr>
<tr>
<td height="40" align="right"> </td>
<td align="left">
<input name="submintButton" type="submit" class="button1" value="确定" >
<input name="reset" type="reset" class="button1" id="reset" value="取消">
</td>
</tr>
</table>
</form>
</td>
<td width="45%"> </td>
</tr>
<tr>
<td height="235"> </td>
<td> </td>
<td> </td>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -