?? registerejb.java
字號:
/*
* Created on 2007/03/05
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package access.register;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.Hashtable;
import javax.ejb.CreateException;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import course.data.ChengJi;
import course.data.KeChengChengJi;
import course.data.login.Login;
import course.ejb.login.LoginHome;
/**
* @author itsuser
*
* TODO To change the template for this generated type comment go to Window -
* Preferences - Java - Code Style - Code Templates
*/
public class RegisterEjb {
private course.ejb.register.RegisterHome getHome() throws NamingException {
return (course.ejb.register.RegisterHome) getContext().lookup(
course.ejb.register.RegisterHome.JNDI_NAME);
}
private InitialContext getContext() throws NamingException {
Hashtable props = new Hashtable();
props.put(InitialContext.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
props.put(InitialContext.PROVIDER_URL, "jnp://127.0.0.1:1099");
// This establishes the security for authorization/authentication
// props.put(InitialContext.SECURITY_PRINCIPAL,"username");
// props.put(InitialContext.SECURITY_CREDENTIALS,"password");
InitialContext initialContext = new InitialContext(props);
return initialContext;
}
public void InsertCustomer_info(String userName, String userNiName,
String userPsw, String userPswQus, String userPswAns,
String userEmail) {
try {
course.ejb.register.Register register = getHome().create();
register.InsertCustomer_info(userName, userNiName, userPsw,
userPswQus, userPswAns, userEmail);
} catch (RemoteException e) {
e.printStackTrace();
} catch (CreateException e) {
e.printStackTrace();
} catch (NamingException e) {
e.printStackTrace();
}
}
public String getUserName(String userName) {
String name=null;
try {
course.ejb.register.Register register = getHome().create();
name = register.getUserName(userName);
} catch (RemoteException e) {
e.printStackTrace();
} catch (CreateException e) {
e.printStackTrace();
} catch (NamingException e) {
e.printStackTrace();
}
return name;
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -