📄 login.jsp
字号:
<%@ 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">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
background-image: url(picture/background.JPG);
}
-->
</style>
</head>
<body>
<table width="215" border="1" align="center">
<tr>
<td width="215" height="100"> </td>
</tr>
<tr>
<td width="215" height="200" background="picture/register_return_215_230_2.gif"><p>
<%
String username1;
String password1;%>
<%
username1=request.getParameter("username");
password1=request.getParameter("password");
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url="jdbc:odbc:lazy";
String user="sa";
String password="111";
ResultSet rs=null;
boolean key=true;
Connection con=DriverManager.getConnection(url,user,password);
Statement stmt=con.createStatement();
String condition="SELECT * FROM yl_register WHERE username='"+username1+"'and password='"+password1+"'";
rs=stmt.executeQuery(condition);
if(rs.next()){
out.println(" 登陆成功,页面正在跳转");%>
</p>
<p>
<%out.println(" 请稍等~~~");%>
<% session.setAttribute("loginname",username1);%>
</p>
<meta http-equiv="Refresh" content="3;URL=main.jsp" />
<%
}else{
out.println(" 用户名或密码错误!!");
stmt.close();
con.close();%>
<meta http-equiv="refresh" content="3;URL=index.htm" />
<%}
}
catch(Exception e){
System.err.println("LMYL ERROR!!"+e.getMessage());
}
%></td>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -