?? accountssessions.java~16~
字號:
package sqlaccounts;/** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2002</p> * <p>Company: </p> * @author unascribed * @version 1.0 */import javax.ejb.*;import javax.naming.*;import javax.rmi.PortableRemoteObject;import java.rmi.RemoteException;import java.util.Collection;import java.util.Hashtable;import java.util.Properties;import java.util.Vector;import java.util.Iterator;import javax.ejb.CreateException;import javax.ejb.DuplicateKeyException;import javax.ejb.FinderException;import javax.ejb.ObjectNotFoundException;import javax.ejb.RemoveException;import javax.naming.Context;import javax.naming.InitialContext;import javax.naming.NamingException;import javax.rmi.PortableRemoteObject;public class AccountsSessions{ // private BorderLayout borderLayout1 = new BorderLayout(); private String sample = "Sample"; private String Type = "Sample"; private EjbAccountsHome ejbAccountsHome = null; public AccountsSessions() { try { Context ctx = new InitialContext(); Object ref = ctx.lookup("EjbAccountsRemote"); this.ejbAccountsHome = (EjbAccountsHome)PortableRemoteObject.narrow(ref,EjbAccountsHome.class); } catch(Exception e) { } } public String getType() { return Type; } public void setType(String newType) { Type = newType; } public String getSample() { return sample; } public void setSample(String newSample) { sample = newSample; } public Vector findByType(String Type) { try { Collection AllejbAccounts = ejbAccountsHome.findByType(Type); if (AllejbAccounts.isEmpty()) return null; Iterator it = AllejbAccounts.iterator(); Vector all=new Vector(); while (it.hasNext()){ EjbAccounts ejbAccounts = (EjbAccounts)(javax.rmi.PortableRemoteObject.narrow(it.next(),EjbAccounts.class)); all.add(new AccountsSessions(ejbAccounts.getType())); } return all; }catch(Exception e){ return null; } } public AccountsSessions AccountsSessions(String type) { AccountsSessions accountsSessions=new AccountsSessions(); accountsSessions.setType(type); return accountsSessions; }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -