?? shoujibean.java~18~
字號:
package JavaBean;
import ejb.*;
import java.util.Properties;
import javax.naming.*;
import java.util.*;
public class ShouJiBean {
Context ct;
ShouJiSessionHome home;
boolean bool = false;
public ShouJiBean() {
try {
ct = this.getInitialContext();
home = (ShouJiSessionHome) ct.lookup("ShouJiSession");
} 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 inster(String photo, String name,
String model, String daXiao, String yanSe,
String zhongLiang, String xiangXiJieShao,
float price){
try{
ShouJiSession rm = home.create();
bool=rm.inster(photo,name,model,daXiao,yanSe,zhongLiang,xiangXiJieShao,price);
}catch(java.lang.Exception e){e.printStackTrace();}
return bool;
}
public boolean xiugai(String photo, String number, String name,
String model, String daXiao, String yanSe,
String zhongLiang, String xiangXiJieShao,
float price) {
try{
ShouJiSession rm = home.create();
bool=rm.xiugai(photo,number,name,model,daXiao,yanSe,zhongLiang,xiangXiJieShao,price);
}catch(Exception e){e.printStackTrace();}
return bool;
}
public boolean delete(String number) {
try{
ShouJiSession rm = home.create();
bool=rm.delete(number);
}catch(java.lang.Exception e){e.printStackTrace();}
return bool;
}
public List selectAll() {
List list = new ArrayList();
try{
ShouJiSession rm = home.create();
list = rm.selectAll();
}catch(java.lang.Exception e){e.printStackTrace();}
return list;
}
public List selectForName(String name) {
List list = new ArrayList();
try{
ShouJiSession rm = home.create();
list = rm.selectForName(name);
}catch(java.lang.Exception e){e.printStackTrace();}
return list;
}
public List selectForPrice(float price) {
List list = new ArrayList();
try{
ShouJiSession rm = home.create();
list= rm.selectForPrice(price);
}catch(java.lang.Exception e){e.printStackTrace();}
return list;
}
// public static void main(String as[]){
//Iterator it = new ShouJiBean().selectForPrice(4).iterator();
// while(it.hasNext()){ShouJiInfoVo vo=(ShouJiInfoVo)it.next(); System.out.print(vo.getDaXiao());}
// }
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -