login.java

来自「利用了Struts的MVC结构」· Java 代码 · 共 37 行

JAVA
37
字号
package cn.com.ahead.A6.TS;

import cn.com.ahead.A6.TransactionProcess;
import javax.naming.*;
import javax.rmi.PortableRemoteObject;

public class login extends TransactionProcess {
  public boolean execute(java.util.SortedMap sm){
   String pwd=null;
   Object ref=null;
   try {
     // try{
        Context ctx = new InitialContext();
        System.out.println("start to find sessionbean");
        ref = ctx.lookup("cn/com/ahead/A6/sessionbean/ejb");
        System.out.println("找到了sessionbean");
     // }catch(NamingException e1){
     //   System.out.println("unable to lookup the EJBHome.  Please make sure that you have deployed the ejb with the JNDI name ");
     //   throw e1;
     // }
      cn.com.ahead.A6.sessionbean.loginHome sessionLoginHome = (cn.com.ahead.A6.sessionbean.loginHome) PortableRemoteObject.narrow(ref, cn.com.ahead.A6.sessionbean.loginHome.class);
      cn.com.ahead.A6.sessionbean.login login=sessionLoginHome.create();
      pwd = login.getPwd((String)sm.get("NAME"));
      System.out.println("现在在Ts中的login方法中得到值:"+pwd);
    } catch(Exception e) {
        pwd = null;
        e.printStackTrace();
    }
    String password=(String)sm.get("PWD");
    if((pwd==null)||(!(password.equals(pwd)))){
      setReturnFlag(false);
    }else{
      setReturnFlag(true);
    }
    return isReturnFlag();
  }
}

⌨️ 快捷键说明

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