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

📄 searchsubscription.jsp

📁 SUN公司官方J2EE中文帮助文档 应该不错 有兴趣的下来看看 html格式的
💻 JSP
字号:
<!-- Copyright 2002 Sun Microsystems, Inc. All rights reserved. SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.--><%@ page language="java" %><%@ page import="java.util.ArrayList" %><%@ page import="java.util.Collection" %><%@ page import="javax.ejb.ObjectNotFoundException" %><%@ page import="javax.naming.InitialContext" %><%@ page import="customer.LocalCustomer" %><%@ page import="customer.LocalCustomerHome" %><%@ page import="customer.LocalSubscription" %><%@ page import="customer.LocalSubscriptionHome" %> <html><head><title>Container-Managed Persistence Demo</title></head><body bgcolor="white"><center><h2>Container-Managed Persistence Demo</h2>Search for a subscription by title:<p>    <form method="get" action="/customer/searchSubscription.jsp">    <input type="text" name="searchText" size="25">    <p>    <input type="submit" value="Search">    </form><%String text = request.getParameter("searchText");LocalSubscription subscription = null;if (text != null && !"".equals(text)) {    try {        InitialContext ic = new InitialContext();        Object o = ic.lookup("java:comp/env/SubscriptionBeanRef");        LocalSubscriptionHome home = (LocalSubscriptionHome) o;        try {          subscription = home.findByPrimaryKey(text);        } catch (ObjectNotFoundException ex) {}%>Results: <p><%if (subscription != null) {%><%=subscription.getTitle()%> [<%=subscription.getType()%>] <p>People who has subscription:<p><%ArrayList customers = subscription.getCustomerList();for (int i = 0; i < customers.size(); i++) {  LocalCustomer customer = (LocalCustomer)customers.get(i);%>  <a href="/customer/editCustomer.jsp?cid=<%=customer.getCustomerID()%>">  <%=customer.getLastName()%>, <%=customer.getFirstName()%></a>  <p><%}if (customers.size() == 0) {%>NONE.<%}%><p><%}%><%    } catch(Exception e) {        e.printStackTrace();        out.println(e.toString());    }}%><hr>[<a href="/customer/index.html">HOME</a>]</center></body></html>

⌨️ 快捷键说明

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