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

📄 adminbean.java

📁 一个使用EJB开发的真实项目
💻 JAVA
字号:
package JavaBean;
import ejb.*;
import java.util.Properties;
import javax.naming.*;


/**远程调用sessionbean进行对表AdminBean操作
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2007</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
public class AdminBean {
    Context ct;
    AdminSessionHome home;
    boolean bool=false;
    public AdminBean() {
        try{
            ct = this.getInitialContext();
            home=(AdminSessionHome)ct.lookup("AdminSession");
        }catch(Exception e){e.printStackTrace();}
    }
    public Context getInitialContext() throws Exception {
           String url = "t3://localhost:7001";
           String user = null;
           String password = null;
           Properties properties;
          try {
                properties = new Properties();
                 properties.put(Context.INITIAL_CONTEXT_FACTORY,
                   "weblogic.jndi.WLInitialContextFactory");
                 properties.put(Context.PROVIDER_URL, url);
                 if (user != null) {
                properties.put(Context.SECURITY_PRINCIPAL, user);
                properties.put(Context.SECURITY_CREDENTIALS,
                password == null ? "" : password);
              }
                 return new javax.naming.InitialContext(properties);
         } catch (Exception e) { throw e;}
       }
       public boolean check(String us,String pw){
           try{
               AdminSession rm = home.create();
               bool = rm.check(us, pw);
           }catch(java.lang.Exception e){bool=false;e.printStackTrace();}
           return bool;
       }
       /*
       public static void main(String a[]){
           if(new AdminBean().check("123","422"))System.out.print("有");
           else{System.out.print("无");}
       }*/

}

⌨️ 快捷键说明

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