📄 interactivequery.jsp
字号:
<!-- Copyright (c) 1999-2002 by BEA Systems, Inc. All Rights Reserved.-->
<!-- Here we use a Java string ("PAGETITLE") to set
the same phrase as the title and as a head.-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;CHARSET=iso-8859-1">
<meta name="description" content="BEA WebLogic Server">
<meta name="keywords" content="BEA WebLogic Server">
<title>Interactive Query</title>
<LINK REL="stylesheet"
TYPE="text/css"
HREF="wls_examples.css"
TITLE="BEA WebLogic Server">
</head>
<body bgcolor="#ffffff" link="#3366cc" vlink="#9999cc" alink="#0000cc">
<!-- top intro paragraph tables -->
<!-- RED LINE -->
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td width="100%" bgcolor="#ff0000" height="1">
<p class="small"> </p>
</td>
</tr>
</table>
<table border=0 cellspacing="18" cellpadding="0">
<tr>
<td valign="top">
<a HREF="http://www.bea.com"><IMG SRC="images/logo_tm_onwt.jpg" alt="BEA Logo" border="0"></a>
<h3>Interactive Query</h3>
</td>
</tr>
</table>
<%@ page import="
weblogic.db.jdbc.*,
java.sql.*
" %>
<%!
Connection conn = null;
String jdbcClass = "com.pointbase.jdbc.jdbcUniversalDriver";
String jdbcURL = "jdbc:pointbase:server://localhost/demo";
public Connection getCon() {
try {
Properties prop = new Properties();
prop.put("user", "examples");
prop.put("password", "examples");
Driver myDriver = (Driver) Class.forName(jdbcClass).newInstance();
conn = myDriver.connect(jdbcURL, prop);
} catch (Exception e) {}
return conn;
}
%>
<%
try {
conn = getCon();
if (conn != null) {
Statement stmt = conn.createStatement();
stmt.execute("select * from emp");
ResultSet ds = stmt.getResultSet();
String myURL = request.getRequestURI();
String person = request.getParameter("person");
if (person == null) {
%>
<!-- RED LINE -->
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td width="100%" bgcolor="#ff0000" height="1">
<p class="small"> </p>
</td>
</tr>
</table>
<table border=0 cellspacing="18" cellpadding="0">
<tr>
<td valign="top">
<table border=1 cellpadding=5>
<th>Employee no</th>
<th>Select a name</th>
<th>Job</th>
<th>Manager</th>
<th>Date of hire</th>
<th>Salary</th>
<th>Commission</th>
<th>Dept no</th>
<%
while (ds.next()) {
String ename = "<a href=" + myURL + "?person=" +
ds.getString("ename") + ">" +
ds.getString("ename") + "</a>";
%>
<tr>
<td><%= ds.getString("empno") != null ? ds.getString("empno") : " " %></td>
<td><%= ename %></td>
<td><%= ds.getString("job") != null ? ds.getString("job") : " " %></td>
<td><%= ds.getString("mgr") != null ? ds.getString("mgr") : " " %></td>
<td><%= ds.getString("hiredate") != null ? ds.getString("hiredate") : " " %></td>
<td><%= ds.getString("sal") != null ? ds.getString("sal") : " " %></td>
<td><%= ds.getString("comm") != null ? ds.getString("comm") : " " %></td>
<td><%= ds.getString("deptno") != null ? ds.getString("deptno") : " " %></td>
</tr>
<%
}
%>
</table>
<%
ds.close();
conn.close();
out.flush();
}
else {
%>
<p>
<b>Results of your interactive query</b>:
<p>
You chose person: <%= person %>
<%
}
}
else {
out.print("Sorry. Database is not available.");
}
} catch (Exception e) {
out.print("Exception: " + e);
}
%>
<br>
</td>
</tr>
</table>
<br>
<!-- RED LINE -->
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td width="100%" bgcolor="#ff0000" height="1">
<p class="small"> </p>
</td>
</tr>
</table>
<!-- FOOTER -->
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td align="left">
<p class="copyright">Last updated: March 2002</p>
</td>
</tr>
</table>
<table cellspacing="0" cellpadding="0" border="0" width="100%"><!-- RED LINE -->
<tr>
<td width="100%" bgcolor="#ff0000" height="1">
<p class="small"> </p>
</td>
</tr>
</table>
<p class="copyright"><a href="http://www.bea.com">Home</a> |
<a href="http://www.bea.com/about/index.html" target="_top">Corporate Info</a> |
<a href="http://www.bea.com/press/index.html" target="_top">News</a> |
<a href="http://www.bea.com/solutions/index.html" target="_top">Solutions</a> |
<a href="http://www.bea.com/products/index.html" target="_top">Products</a> |
<a href="http://www.bea.com/partners/index.html" target="_top">Partners</a> |
<a href="http://www.bea.com/services.html" target="_top">Services</a> |
<a href="http://www.bea.com/events/index.html" target="_top">Events</a> |
<a href="http://www.bea.com/download.html" target="_top">Download</a> |
<a href="http://www.bea.com/purchase.html" target="_top">How to Buy</a>
<br>Copyright 2002, BEA Systems, Inc. All rights reserved.
<br>Required browser: Netscape 4.0 or higher, or Microsoft Internet Explorer 4.0 or higher.
<br> <a href="http://www.bea.com/contact/index.html" target="_top">Contact BEA</a>
</p>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -