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

📄 enrollmentcartejb.java

📁 学生注册— 本模块允许新的学生创建和维护他们的帐户信息
💻 JAVA
字号:
package day21ex.enrollmentcart;

import java.util.*;
import javax.ejb.*;
import javax.naming.*;

public class EnrollmentCartEJB implements SessionBean  {
   private SessionContext ctx;
   private HashSet cart;
   public EnrollmentCartEJB() {
      print("The container created this instance.\n");
   }
   public void setSessionContext(SessionContext ctx) {
      print("The container called the setSessionContext method ");
      print("to associate session bean instance with its context.\n");
      this.ctx = ctx;
   }
   public void ejbCreate() throws CreateException {
      print("The container called the ejbCreate method.\n");
      cart = new HashSet();
   }
   public void ejbActivate() {
      print("This instance has just been reactivated.\n");
   }
   public void ejbPassivate() {
      print("The container intends to passivate the instance.\n");
   }
   public void ejbRemove() {
      print("This instance is in the process of being removed ");
      print("by the container.\n");
   }
   public void addCourses(String[] courseIds) {
      print("The container called addCourses method.\n");
      if ( courseIds == null) {
         return;
      }
      for ( int i = 0; i < courseIds.length ; i ++ ) {
         print("Adding Course" + courseIds[i]);
         cart.add(courseIds[i]);
      }

   }
   public Collection getCourses() {
      print("The container called getCourses method.\n");
      Iterator it = cart.iterator();
      while (it.hasNext()) {
         print((String)it.next());
      }
      return cart;
   }
   public void empty() {
      print("The container called empty method.\n");
      cart.clear();
   }
   void print(String s) {
      System.out.println("EnrollmentCartEJB:"+s);
   }
}

⌨️ 快捷键说明

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