?? login.jsp
字號(hào):
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<% @page contentType="text/html; charset=GBK" %>
<% @page import="java.util.*" %>
<% @page import="java.sql.*" %>
<jsp:useBean id="myconnect" scope="session" class="student.DBConnect" />
<%
String name=request.getParameter("name");
String password=request.getParameter("password");
if(name!=null&&password!=null)
{ ResultSet rs;
String sqlText="select * from user where name='"+name+"'and password='"password+"';";
rs=myconnect.DBQuery(sqlText);
if(rs!=null && rs.next()==true)
{ session.setAttribute("login","true");
response.sendRedirect("main.jsp");
} else{
response.setAttribute("error","用戶驗(yàn)證失敗!");
}
}
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>宿舍管理系統(tǒng)</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> // charset=utf-8
<script type="text/javascript">
function check()
{
if(form.name.value=="")
{
alert("請輸入用戶名");
document.form.name.focus();
} else
{
if(form.password.value=="");
{
alert("請輸入密碼");
document.form.password.focus();
} else
{
form.submit();
}
}
}
</script>
</head>
<body bgcolor=#CFE3CA text="#004080">
<form method="post" action="=login.jsp" name="form">
<p>
</p>
<blockquote>
<h1 align="center">
宿舍管理系統(tǒng)
</h1>
<hr>
</blockquote>
<p align="center">
用戶名:
<input type="text" name="name" size="10">
</p>
<p align="center">密 碼:
<input type="password" name="password" size="10" />
</p>
<p align="center">
<input type="submit" name="submitl" value="確定" onclick="check()">
<input type="reset" name="submit2" value="取消">
</p>
<p align="center"> </p>
</form>
</body>
</html>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -