📄 youtian.jsp
字号:
<%@ page contentType="text/html;charset=GBK"%>
<%@ include file="Connections/oracle.jsp" %>
<%
Driver Driverrecord = (Driver)Class.forName(MM_oracle_DRIVER).newInstance();
Connection Connrecord = DriverManager.getConnection(MM_oracle_STRING,MM_oracle_USERNAME,MM_oracle_PASSWORD);
PreparedStatement Statementrecord = Connrecord.prepareStatement("SELECT * FROM HR.SENSORINF");
ResultSet record = Statementrecord.executeQuery();
boolean record_isEmpty = !record.next();
boolean record_hasData = !record_isEmpty;
Object record_data;
int record_numRows = 0;
%>
<% String MM_paramName = ""; %>
<%
// *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters
String MM_keepBoth,MM_keepURL="",MM_keepForm="",MM_keepNone="";
String[] MM_removeList = { "index", MM_paramName };
// create the MM_keepURL string
if (request.getQueryString() != null) {
MM_keepURL = '&' + request.getQueryString();
for (int i=0; i < MM_removeList.length && MM_removeList[i].length() != 0; i++) {
int start = MM_keepURL.indexOf(MM_removeList[i]) - 1;
if (start >= 0 && MM_keepURL.charAt(start) == '&' &&
MM_keepURL.charAt(start + MM_removeList[i].length() + 1) == '=') {
int stop = MM_keepURL.indexOf('&', start + 1);
if (stop == -1) stop = MM_keepURL.length();
MM_keepURL = MM_keepURL.substring(0,start) + MM_keepURL.substring(stop);
}
}
}
// add the Form variables to the MM_keepForm string
if (request.getParameterNames().hasMoreElements()) {
java.util.Enumeration items = request.getParameterNames();
while (items.hasMoreElements()) {
String nextItem = (String)items.nextElement();
boolean found = false;
for (int i=0; !found && i < MM_removeList.length; i++) {
if (MM_removeList[i].equals(nextItem)) found = true;
}
if (!found && MM_keepURL.indexOf('&' + nextItem + '=') == -1) {
MM_keepForm = MM_keepForm + '&' + nextItem + '=' + java.net.URLEncoder.encode(request.getParameter(nextItem));
}
}
}
String tempStr = "";
for (int i=0; i < MM_keepURL.length(); i++) {
if (MM_keepURL.charAt(i) == '<') tempStr = tempStr + "<";
else if (MM_keepURL.charAt(i) == '>') tempStr = tempStr + ">";
else if (MM_keepURL.charAt(i) == '"') tempStr = tempStr + """;
else tempStr = tempStr + MM_keepURL.charAt(i);
}
MM_keepURL = tempStr;
tempStr = "";
for (int i=0; i < MM_keepForm.length(); i++) {
if (MM_keepForm.charAt(i) == '<') tempStr = tempStr + "<";
else if (MM_keepForm.charAt(i) == '>') tempStr = tempStr + ">";
else if (MM_keepForm.charAt(i) == '"') tempStr = tempStr + """;
else tempStr = tempStr + MM_keepForm.charAt(i);
}
MM_keepForm = tempStr;
// create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth = MM_keepURL + MM_keepForm;
if (MM_keepBoth.length() > 0) MM_keepBoth = MM_keepBoth.substring(1);
if (MM_keepURL.length() > 0) MM_keepURL = MM_keepURL.substring(1);
if (MM_keepForm.length() > 0) MM_keepForm = MM_keepForm.substring(1);
%>
<%@ page import="java.sql.*"%>
<html>
<meta http-equiv="content-type" content="text/html; charset=GBK">
<style type="text/css">
<!--
.style2 {color: #000000; }
-->
</style>
<title>胜利油田企业网</title><body>
<TD background="5.gif"> <h1 align="center" class="style2">胜利油田</h1>
<table width="893" border="0">
<tr>
<td width="703"><IMG height=120 src="01.gif" width=800></td>
<td width="174">
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function Year_Month(){
var now = new Date();
var yy = now.getYear();
var mm = now.getMonth()+1;
var cl = '<font color="#000000">';
return(cl +yy + '年' + mm + '月</font>');
}function Date_of_Today(){
var now = new Date();
var cl = '<font color="#000000"><b>';
if (now.getDay() == 0) cl = '<font color="#FF0000"><b>';
if (now.getDay() == 6) cl = '<font color="#008000"><b>';
return(cl +now.getDate() + '</font></b>');
}function Day_of_Today(){
var day = new Array();
day[0] = "星期日";
day[1] = "星期一";
day[2] = "星期二";
day[3] = "星期三";
day[4] = "星期四";
day[5] = "星期五";
day[6] = "星期六";
var now = new Date();
var cl = '<font color="#000000">';
if (now.getDay() == 0) cl = '<font color="#FF0000">';
if (now.getDay() == 6) cl = '<font color="#FF0000">';
return(cl +day[now.getDay()] + '</font>');
}function CurentTime(){
var now = new Date();
var hh = now.getHours();
var mm = now.getMinutes();
var ss = now.getTime() % 60000;
ss = (ss - (ss % 1000)) / 1000;
var clock = hh+':';
if (mm < 10) clock += '0';
clock += mm+':';
if (ss < 10) clock += '0';
clock += ss;
return(clock);
}function refreshCalendarClock(){
document.all.calendarClock1.innerHTML = Year_Month();
document.all.calendarClock2.innerHTML = Date_of_Today();
document.all.calendarClock3.innerHTML = Day_of_Today();
document.all.calendarClock4.innerHTML = CurentTime();
}document.write('<table border="0" cellpadding="0" cellspacing="0" width="70" bgcolor="#C0C0C0" height="83">');
document.write('<tr><td valign="top" width="100%" height="100%">');
document.write('<table border="1" bordercolor="#993300" cellpadding="0" cellspacing="0" width="80" bgcolor="#FFFF99" height="100">');
document.write('<tr><td align="center" width="100%" height="100%" >');
document.write('<font id="calendarClock1" style="font-family:宋体;font-size:9pt;line-height:120%"> </font><br>');
document.write('<font id="calendarClock2" style="font-family:Arial;font-size:18pt;line-height:120%"> </font><br>');
document.write('<font id="calendarClock3" style="font-family:宋体;font-size:9pt;line-height:120%"> </font><br>');
document.write('<font id="calendarClock4" style="color:#000000;font-family:宋体;font-size:9pt;line-height:120%"><b> </b></font>');
document.write('</td></tr></table>');
document.write('</td></tr></table>');
refreshCalendarClock()
setInterval('refreshCalendarClock()',1000);
// End -->
</SCRIPT>
</td>
</tr>
</table>
<style>
body { font-family: "宋体", "Arial Narrow", "Times New Roman"; font-size: 15px;}
td { font-family: "宋体", "Arial Narrow", "Times New Roman"; font-size: 13px;}
.p9 { font-family: "宋体", "Arial Narrow", "Times New Roman"; font-size: 10pt;}
.menuitem {BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; POSITION: absolute; VISIBILITY: hidden}
.menubar {BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; FILTER: revealTrans(transition=10,duration=0.5) blendTrans(duration=0.5); POSITION: absolute; VISIBILITY: visible}
.menuline { font-family: "宋体", "Arial Narrow", "Times New Roman"; font-size: 10px;line-height:15pt}
</style>
<p></p>
<SCRIPT language=JavaScript>
function Show(divid) {
divid.style.visibility = "visible";
}
function Hide(divid) {
divid.style.visibility = "hidden";
}
</SCRIPT>
<table width="99%" height="20" border="1" bgcolor="#008800" bordercolor="#008800" bordercolordark="#ffffff" bordercolorlight="#000000">
<tr nowrap>
<td width="25%" bgcolor="#008800" onMouseOut=Hide(hot1); onMouseOver=Show(hot1);><font color="#ffffff">公司简介</font><br>
<div id="hot1" class="menuitem">
<table width="100%" bgcolor="#aaeeaa">
<tr>
<td class="p9">
<a href="jianshezhong.jsp" target="_blank">公司介绍</a></td>
</tr>
<tr>
<td class="p9">
<a href="jianshezhong.jsp" target="_blank">公司领导</a></td>
</tr>
<tr>
<td class="p9" height="7"> </td>
</tr>
</table>
</div>
</td>
<td width="25%" bgcolor="#008800" onMouseOut=Hide(hot2); onMouseOver=Show(hot2);><font color="#ffffff">企业文化</front><br>
<div id="hot2" class="menuitem">
<table width="100%" bgcolor="#aaeeaa">
<tr>
<td class="p9">
<a href="jianshezhong.jsp" target="_blank">人文环境</a></td>
</tr>
<tr>
<td class="p9">
<a href="jianshezhong.jsp" target="_blank">企业理念</a></td>
</tr>
<tr>
<td class="p9" height="7"> </td>
</tr>
</table>
</div>
</td>
<td width="25%" bgcolor="#008800" onMouseOut=Hide(hot3); onMouseOver=Show(hot3);><font color="#ffffff">科研项目</font><br>
<div id="hot3" class="menuitem">
<table width="100%" bgcolor="#aaeeaa">
<tr>
<td class="p9">
<a href="jianshezhong.jsp" target="_blank">北京生产基地</a></td>
</tr>
<tr>
<td class="p9">
<a href="jianshezhong.jsp" target="_blank">天津生产基地</a></td>
</tr>
<tr>
<td class="p9" height="7"> </td>
</tr>
</table>
</div>
</td>
<td width="25%" bgcolor="#008800" onMouseOut=Hide(hot4); onMouseOver=Show(hot4);><font color="#ffffff">客户服务</font><br>
<div id="hot4" class="menuitem">
<table width="100%" bgcolor="#aaeeaa">
<tr>
<td class="p9">
<a href="jianshezhong.jsp" target="_blank">联系信息</a></td>
</tr>
<tr>
<td class="p9">
<a href="jianshezhong.jsp" target="_blank">信息反馈</a></td>
</tr>
<tr>
<td class="p9" height="7"> </td>
</tr>
</table>
</div>
</td>
</tr>
</table>
<p>
<%
Class.forName("oracle.jdbc.driver.OracleDriver"); //.newInstance();
String url="jdbc:oracle:thin:@202.204.53.65:1521:ORACLEDB"; //mydb为数据库的SID,10.0.1.1 为 数据库服务器 IP
String user="system";
String password="manager";
Connection conn= DriverManager.getConnection(url, user, password);
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
String sql="select * from HR.SENSORINF"; //test 是表名,要先建立这个表,再送几条记录
ResultSet rs=stmt.executeQuery(sql);
%>
</p>
<table width="99%" border="1" cellpadding="0" cellspacing="0">
<tr>
<td width="9%" height="32"> <div align="center">ID</div></td>
<td width="12%"> <div align="center">传感器编号</div></td>
<td width="15%"><div align="center">所属岗位</div></td>
<td width="15%"><div align="center">所属站</div></td>
<td width="12%"><div align="center">报警下限</div></td>
<td width="10%"> <div align="center">报警上限</div></td>
<td width="13%"> <div align="center">类型</div></td>
<td width="14%"> <div align="center">传感器位置</div></td>
</tr>
<%
while(rs.next())
{
%>
<tr>
<td height="37"><div align="center"><%=rs.getString(1)%></div></td>
<td><div align="center"><%=rs.getString(2)%></div></td>
<td><div align="center"><%=rs.getString(3)%></div></td>
<td><div align="center"><%=rs.getString(4)%></div></td>
<td><div align="center"><%=rs.getString(5)%></div></td>
<td><div align="center"><%=rs.getString(6)%></div></td>
<td><div align="center"><%=rs.getString(7)%></div></td>
<td><div align="center"><%=rs.getString(8)%></div></td>
</tr>
<p>
<%
}%>
</table>
<p>
<%
rs.close();
stmt.close();
conn.close();
%>
<A HREF="add.jsp?<%= MM_keepNone + ((MM_keepNone!="")?"&":"") + "SENSORID=" + (((record_data = record.getObject("SENSORID"))==null || record.wasNull())?"":record_data) %>">添加记录</A> </p>
</p>
<p> </p>
</body>
</html>
<%
record.close();
Statementrecord.close();
Connrecord.close();
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -