⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cartbean.java

📁 MICO2.3.13 corba 环境平台
💻 JAVA
字号:
package examples;import java.util.*;import javax.ejb.*;public class CartBean implements SessionBean {   String customerName;   String customerId;   Vector contents;   public void ejbCreate(String person) throws CreateException {      if (person == null) {        throw new CreateException("Null person not allowed.");      }      else {         customerName = person;      }      customerId = "0";      contents = new Vector();   }   public void ejbCreate(String person, String id) throws CreateException {      if (person == null) {        throw new CreateException("Null person not allowed.");      }      else {         customerName = person;      }      IdVerifier idChecker = new IdVerifier();      if (idChecker.validate(id)) {         customerId = id;      }      else {         throw new CreateException("Invalid id: " + id);      }      contents = new Vector();   }   public void addBook(String title) {      contents.addElement(title);   }   public void removeBook(String title) throws BookException {      boolean result = contents.removeElement(title);      if (result == false) {         throw new BookException(title + " not in cart.");      }   }   public String[] getContents() {      return (String[])contents.toArray(new String[contents.size()]);   }   public CartBean() {}   public void ejbRemove() {}   public void ejbActivate() {}   public void ejbPassivate() {}   public void setSessionContext(SessionContext sc) {}} 

⌨️ 快捷键说明

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