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

📄 display.jsp~41~

📁 Java源码 Java源码
💻 JSP~41~
字号:
<%@ page contentType="text/html; charset=GBK" %>
<%@ page import="java.util.*" %>
<%@ page import="javax.servlet.*" %>
<%@ page import="java.io.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="javax.servlet.http.*" %>
<%@ page import="javax.naming.*" %>
<%@ page import="cmp2image.*" %>
<%@ page import="javax.rmi.PortableRemoteObject" %>
<html>
<head>
<title>
display
</title>
</head>
<body bgcolor="#ffffff">
<h1 align=center>
Images and its name
</h1>
<table cellpadding="5" cellspacing="5" border="2" width="600">
<tr>
<%
    String name="No Name";
    Context context;
    String url = "t3://localhost:7001";
    String user = null;
    String password = null;
    Properties properties = null;
    try {
      properties = new Properties();
      properties.put(Context.INITIAL_CONTEXT_FACTORY,
                     "weblogic.jndi.WLInitialContextFactory");
      properties.put(Context.PROVIDER_URL, url);
      if (user != null) {
        properties.put(Context.SECURITY_PRINCIPAL, user);
        properties.put(Context.SECURITY_CREDENTIALS,
                       password == null ? "" : password);
      }

       context = new InitialContext(properties);
    }
    catch (Exception e) {
      System.out.println("Unable to connect to WebLogic server at " + url);
      System.out.println("Please make sure that the server is running.");
      throw e;
    }
	try {
        //look up jndi name
        Object ref = context.lookup("Catalog");
        //look up jndi name and cast to Home interface
        CatalogHome catalogHome = (CatalogHome) PortableRemoteObject.narrow(ref, CatalogHome.class);

        Catalog catalog = catalogHome.create();
        ArrayList collection = catalog.getAll();

        Iterator i = collection.iterator();
        int count=0;
	while (i.hasNext()) {
          Object obj = i.next();
          count=count+1;
          if (obj instanceof String) {
            name = (String) obj;
%><td valign="top" align="center"><%=name%><br>
<img src="imageservlet?action=all&pic=<%=name%>" border="0" height="95" width="80"  hspace="6">
</td>
<%
          }
        }

      }
      catch (Exception ex) {
        ex.printStackTrace();
      }

%>

</tr>
</table>
</body>
</html>

⌨️ 快捷键说明

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