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

📄 cdmanage.jsp

📁 《J2EE企业级应用开发》一书的配套源代码
💻 JSP
字号:
<%@ page import="java.io.IOException,java.util.*,javax.naming.*,javax.servlet.*,javax.servlet.http.*,javax.rmi.PortableRemoteObject,com.hellking.study.ejb.*" %>

<%      try
      {
         // Get a naming context
         InitialContext jndiContext = new InitialContext();

         // Get a reference to a CD Bean
         
         Object ref  = jndiContext.lookup("cd/CDCollection");

         // Get a reference from this to the Bean's Home interface
         CDCollectionHome home = (CDCollectionHome)PortableRemoteObject.narrow(ref,CDCollectionHome.class);
	
         CDCollection cdCollection = home.create();
	 //cdCollection.addCD(new Integer("1"));
	//cdCollection.addCD(new Integer("2"));
	//cdCollection.addCD(new Integer("3"));
         Collection cds=cdCollection.findAll();
         Iterator iterator=cds.iterator();
         while(iterator.hasNext())
         {
         	CD cd=(CD)iterator.next();
         	out.println (cd.getId() + "\t" + cd.getTitle() + "\t" +cd.getArtist() + "\t" + cd.getType());
         }

         
      }
      catch(Exception e)
      {
         out.println(e.toString());
      }
  out.println("sucess");
   %>

⌨️ 快捷键说明

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