?? login.java
字號:
package org.pan.web;
import java.sql.*;
import org.pan.util.*;
/**
* Title: 用戶登錄信息檢查
* Description:
* Copyright: Copyright (c) 2003
* @author: siny pan
* @version 1.0
*/
public class login extends DataBase {
private String adminName; //登錄用戶名
private String password; //登錄密碼
public String sqlStr = ""; //sql String
public String errorMessage = ""; //數據庫錯誤信息
public login() throws Exception{
super();
adminName = "";
password = "";
}
public String getAdminName() {
return adminName;
}
public void setAdminName(String newAdminName) {
adminName = newAdminName;
}
public String getPassword() {
return password;
}
public void setPassword(String newpassword) {
password = newpassword;
}
public String getSql() {
sqlStr = "select * from admin where adminName = '" + strFormat.toSql(adminName) + "' and password = '" + strFormat.toSql(password) + "'";
return sqlStr;
}
//根據用戶名和密碼查詢數據庫并返回登陸是否成功
public boolean excute() throws Exception {
boolean flag = false;
try {
rs = stmt.executeQuery(getSql());
if (rs.next()){
flag = true;
rs.close();
} else {
this.errorMessage = "對不起,輸入的登陸帳號或密碼錯誤!";
}
}
catch(Exception ex) {
this.errorMessage = sqlStr + ex.getMessage();
} finally {
close();
}
return flag;
}
};
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -