📄 display.jsp~36~
字号:
<%@ 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 cellspacing="5" border="0" width="600">
<%
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;
if(count==1)
// session.setAttribute("name", name.trim());
{
%><tr><th valign="top" align="center"><%=name%><br></th>
<tr><td valign="top" align="center"> <img src="imageservlet?action=all&pic=<%=name%>" border="0" height="95" width="80" hspace="6">
</td>
<%
}
else
{%>
<th valign="top" align="center"><%=name%><br></th>
<td valign="top" align="center"> <img src="imageservlet?action=all&pic=<%=name%>" border="0" height="95" width="80" hspace="6" >
</td>
<%
}
%>
<%
}
%>
<%
}
%>
<%
}
catch (Exception ex) {
ex.printStackTrace();
}
%>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -