当你输入任意用户名时:
//这里bean为空
process bean=home.findByPrimaryKey(id);
//这里抛出空指针错误
String ps=bean.getPassword(); 所以resultpage还是"/index.jsp";
//这里bean为空
process bean=home.findByPrimaryKey(id);
//这里抛出空指针错误
String ps=bean.getPassword(); 所以resultpage还是"/index.jsp";
static private E21Manager instance; public E21Manager() {
init();
} static synchronized public E21Manager getInstance() {
if (instance == null) {
instance = new E21Manager();
}
return instance;
} private void init() {
try {
System.out.println("InitialContext ---------------");
Context ctx = new InitialContext();
sE21NameService = (String) ctx.lookup("java:/comp/env/Edge21NameService"); String sRunTimeUser = "Edge21eccbrg";
String sRunTimePwd = "abc123"; System.setProperty("java.naming.factory.initial",
"com.inprise.j2ee.jndi.CtxFactory");
System.setProperty("ORBInitRef", sE21NameService); System.setProperty("javax.rmi.CORBA.StubClass",
"com.inprise.vbroker.rmi.CORBA.StubImpl");
System.setProperty("javax.rmi.CORBA.UtilClass",
"com.inprise.vbroker.rmi.CORBA.UtilImpl");
System.setProperty("javax.rmi.CORBA.PortableRemoteObjectClass",
"com.inprise.vbroker.rmi.CORBA.PortableRemoteObjectImpl");
System.setProperty("org.omg.CORBA.ORBClass",
"com.inprise.vbroker.orb.ORB");
System.setProperty("org.omg.CORBA.ORBSingletonClass",
"com.inprise.vbroker.orb.ORBSingleton"); System.out.println("sE21NameService = [" + sE21NameService + "]"); log.log("sE21NameService = [" + sE21NameService + "]");
}
catch (Exception ex) {
Timestamp ts = new Timestamp(System.currentTimeMillis());
ex.printStackTrace(pw);
log.error("***************** E21Manager - init ********************");
log.error(sw.toString());
log.error("***************** E21Manager - init ********************"); }
} public SCMInternetController2Remote getSCMInternetRemote() throws Exception {
SCMInternetController2Remote remote;
try { Context ctx = new InitialContext();
String contextStr = "edge21/scm2/SCMInternetController2";
System.out.println("Node: " + contextStr);
Object objRef = ctx.lookup(contextStr);
SCMInternetController2Home scmInternetControllerHome = (
SCMInternetController2Home) PortableRemoteObject.narrow(objRef,
SCMInternetController2Home.class);
remote = scmInternetControllerHome.create();
return remote;
}
catch (Exception ex) {
throw ex;
}
}
然后用DAO的模式,得到所有的数据,在servlet中call DAO中的数据。