<%@ page language="java" contentType="text/html; charset=GB2312"
pageEncoding="GB2312"%>
<%@ page import="java.sql.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB2312">
<title>JSP Connection Oracle 10G</title>
</head>
<body>
<%
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
String url = "jdbc:oracle:thin:@localhost:1521:orcl";
//orcl为你的数据库的SID
String user = "jielan";
String password = "jielan";
Connection conn = DriverManager.getConnection(url, user, password);
Statement stmt = conn
.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
String sql = "select * from jie";
ResultSet rs = stmt.executeQuery(sql);
while (rs.next()) {
%>
<h1>我们都是好孩子</h1><hr>
我的工号是:
<a href="./myjsp/johnwall.jsp" target="_blank"><%=rs.getString("id") %> </a>
<br>
<br>
<label>我的名字</label>
<a href="http://www.sohu.com/" target="_blank"><%=rs.getString("name") %></a>
<br>
<br>
<label>姚明的身高为:</label>
<A href="http://www.163.com/" target="_blank"><%=rs.getString("length") %></A>
<br>
<br>
<label>李孝利的发型:</label>
<a href="http://www.tom.com/" target="_blank"><%=rs.getString("fair") %></a>
<br>
<br>
<%
}
%>
<%
out.print("数据库操作成功,恭喜你");
%>
<form id="showit" action="" method="post">
<h1 align="middle">
帝国信息技术有限公司
</h1>
<table border="2">
<tr>
<th width="100">
掌上杭州
</th>
<th width="100">
手机移动网
</th>
<th width="100">
手机输入法
</th>
<th width="100">
移动搜搜
</th>
<th width="100">
手机地图
</th>
<th width="100">
合作伙伴
</th>
</tr>
<tr>
<td width="100">
<%
request.getAttribute("id");
%>
</td>
<td width="100">
<%
out.print("id");
%>
</td>
<td width="100">
<%
out.print("id");
%>
</td>
<td width="100">
<%
out.print("id");
%>
</td>
<td width="100">
<%
out.print("id");
%>
</td>
<td width="100">
<%
out.print("id");
%>
</td>
</tr>
以下内容由:
<a href="http://www.baidu.com/" target="_blank">百度</a> 提供搜索,感谢百度的帮忙!
</table>
</form>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=GB2312"
pageEncoding="GB2312"%>
<%@ page import="java.sql.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB2312">
<title>约翰沃尔</title>
</head>
<body>
<form id="john" action="" method="post">
<h1 align="justify">华盛顿奇才队,约翰沃尔</h1>
<hr>
<br>
<h2>John wall简介</h2>
<table border="2" >
<tr>
<th width="100">
国籍
</th>
<th width="100">
语言
</th>
<th width="100">
身高
</th>
<th width="100">
体重
</th>
<th width="100">
出生日期
</th>
</tr>
<tr>
<%
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
try {
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
conn = DriverManager
.getConnection("jdbc:oracle:thin:@localhost:1521:orcl",
"john", "john");
stmt = conn.createStatement();
rs = stmt.executeQuery("select * from wall");
while (rs.next()) {
%>
<td width="100"><a href="../myjsp/american.jsp" target="_blank"><%=rs.getString("nation") %></a>
</td>
<td width="100">
<%=rs.getString("language") %>
</td>
<td width="100">
<%=rs.getString("length") %>
</td>
<td width="100">
<%=rs.getString("weight") %>
</td>
<td width="100">
<%=rs.getString("data") %>
</td>
<%
}
%>
<%
} catch (Exception e) {
e.printStackTrace();
} finally {
if (rs != null) {
rs.close();
}
if (stmt != null) {
stmt.close();
}
if (conn != null) {
conn.close();
}
}
%>
</tr>
</table>
</form>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=GB2312"
pageEncoding="GB2312"%>
<%@ page import="java.sql.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB2312">
<title>American Introduce</title>
</head>
<body>
<form id="mei" action="" method="">
<%
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
try {
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
conn = DriverManager
.getConnection("jdbc:oracle:thin:@localhost:1521:orcl",
"ame", "ame");
stmt = conn.createStatement();
rs = stmt.executeQuery("select * from mei");
while (rs.next()) {
%>
美利坚合众国简介:
<!--
<input type="textarea" name="introduce" value="请输入:"><HR>
-->
<%=rs.getString(2) %>
<%
}
%>
<%
} catch (Exception e) {
e.printStackTrace();
} finally {
if (rs != null) {
rs.close();
}
if (stmt != null) {
stmt.close();
}
if (conn != null) {
conn.close();
}
}
%>
</form>
</body>
</html>