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

📄 loginbean.java

📁 this servlet for system login
💻 JAVA
字号:
package com.talent.system.login;import java.rmi.*;import java.util.*;import java.sql.*;import javax.ejb.*;import javax.naming.*;import javax.sql.RowSet;import javax.transaction.UserTransaction;import weblogic.jndi.*;import sun.jdbc.rowset.*;import com.talent.publics.*;/** * <p>Title: Login</p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2003-01-05</p> * <p>Company: www.chinatalent.com</p> * @author jingyucui * @version 1.0 */public class LoginBean implements SessionBean {  private SessionContext sessionContext;  public void ejbCreate() {  }  public void ejbRemove() {  }  public void ejbActivate() {  }  public void ejbPassivate() {  }  public void setSessionContext(SessionContext sessionContext) {    this.sessionContext = sessionContext;  }//核对该登陆操作员是否存在,返回“真”存在,返回“假”不存在  public boolean checkLoginUser(String id) throws Exception, SQLException{    try{      DbBean dbBean = new DbBean();      ResultSet resultSet;      String sql = "select count(*) from operator where  operatorid = '" + id+"'";System.out.println("CheckLoginUserSql========"+sql);      resultSet = dbBean.execQuery(sql);      while(resultSet.next()){        if (resultSet.getString(1).equals("0")){          dbBean.close();          return false;        }else{          dbBean.close();          return true;        }      }      dbBean.close();    }catch(Exception e){      return false;    }    return true;  }//核对该操作员的密码是否正确,返回"假"密码不正确,返回“真”正确  public boolean checkLoginPassword(String id,String password) throws Exception, SQLException{    try{      DbBean dbBean = new DbBean();      ResultSet resultSet;      String sql = "select password from operator where  operatorid = '" + id+"'";System.out.println("CheckLoginPasswordSql========"+sql);      resultSet = dbBean.execQuery(sql);      while(resultSet.next()){        if (resultSet.getString(1).equals(password)){          dbBean.close();          return true;        }else{          dbBean.close();          return false;        }      }      dbBean.close();     }catch(Exception e){      return false;    }    return true;  }//提取登陆操作员信息  public RowSet selectLoginUser(String id) throws Exception{    try{      DbBean dbBean = new DbBean();      ResultSet resultSet;      CachedRowSet cachedRowSet = new CachedRowSet();      String sql = "select operator.operatorid,operator.operatorname,operator.operatorrole,operator.powergroup,depart.departid,depart.departname from operator,depart where operator.operatorid = '"+id+"' and operator.depart = depart.departid";System.out.println("SelectLoginSql========"+sql);      resultSet = dbBean.execQuery(sql);      cachedRowSet.populate(resultSet);      dbBean.close();      return cachedRowSet;    }catch(Exception e){      return null;    }  }}

⌨️ 快捷键说明

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