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

📄 getmedia.jsp

📁 《J2EE企业级应用开发》一书的配套源代码
💻 JSP
字号:
<%@ page import="java.io.IOException,java.util.*,javax.naming.*,javax.servlet.*,
javax.servlet.http.*,java.rmi.*,javax.rmi.PortableRemoteObject,javax.ejb.*,com.j2eeapp.cdstore.storage.*,com.j2eeapp.cdstore.vo.*,com.j2eeapp.cdstore.util.*" %>
<%
	InitialContext ctx=new InitialContext();
   String productId="product_Demo_11";
   
   try
   {
   	 

ProductLocalHome productHome=(ProductLocalHome)new InitialContext().lookup(JNDINames.PRODUCT);
   	   ProductLocal productLocal=productHome.findByPrimaryKey(productId);
   	   Product productVO=new Product(productLocal.getProductId(),productLocal.getCategory().getCateId(),
   	   			productLocal.getName(),productLocal.getDescription(),(Collection)productLocal.getMediaList());
   	   			 Collection medias =productVO.getMedia();
 if(medias!=null)out.println("mediasnotnull");
 out.println(medias.size());
Iterator it=medias.iterator();
%>
<table border="0" cellspacing="0" cellpadding="2" width="500">

   <tr>
   <th background="images/titlebar_stretch.gif" valign="top" class="title" align="left">曲名</th>
   <th background="images/titlebar_stretch.gif" align="right" valign="center" class="title">描述  </th>
   <th background="images/titlebar_stretch.gif" align="right" valign="center" class="title">时间 </th>
      <th background="images/titlebar_stretch.gif" align="right" valign="center" class="title">出品人 </th>
  </tr>
<% while(it.hasNext())
  {  
     Media pr=(Media)it.next();
  %>  
  <Tr>
  <td class="heading"><%=pr.getFileName()%></td>
  <td class="heading"><%=pr.getDescription()%></td>
  <td class="heading"><%=pr.getTime()%></td>
  <td class="heading"><%=pr.getProducer()%></td>
  
  </Tr>
  <%}%>
</table>
<%
   	   	}
	catch(NamingException e)
	{
	    e.printStackTrace();
	 }
	 

%>

⌨️ 快捷键说明

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