📄 showpic.jsp
字号:
<%-- showPic.jsp程序代码 --%>
<%@ page contentType="text/html;charset=gb2312" %>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.sql.DriverManager" %>
<%@ page import="java.sql.Statement" %>
<%@ page import="java.sql.ResultSet" %>
<%@ page import="java.sql.SQLException" %>
<%
//建立数据库连接并执行查询
Connection conn=null;
Statement stmt=null;
ResultSet rs=null;
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:datasource_suit","sa","710318");
String strSQL="select title,info from t_picture";
stmt=conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
rs=stmt.executeQuery(strSQL);
rs.last(); //将最后一张图片的标题、说明信息显示出来
%>
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>浏览图片</title>
</head>
<body>
<div align="center">
<center>
<table border="0" width="391" height="254">
<tr>
<td width="375" height="24" align="center" bgcolor="#FFEADF" colspan="2"><b><font face="仿宋_GB2312" color="#FF00FF">图
片 浏 览</font></b></td>
</tr>
<tr>
<td width="84" height="24" align="center" bgcolor="#FFEADF"><font face="仿宋_GB2312">标题</font></td>
<td width="291" height="24" align="center" bgcolor="#FFEADF"><font face="仿宋_GB2312"><%=rs.getString("title")%></font></td>
</tr>
<tr>
<td width="84" height="76" align="center" bgcolor="#FFEADF"><font face="仿宋_GB2312">图片说明</font></td>
<td width="291" height="76" align="center" bgcolor="#FFEADF"><font face="仿宋_GB2312"><textarea rows="5" name="S1" cols="37"><%=rs.getString("info")%></textarea></font></td>
</tr>
<tr>
<td width="84" height="140" align="center" bgcolor="#FFEADF"><font face="仿宋_GB2312">图片</font></td>
<td width="291" height="140" align="center" bgcolor="#FFEADF"><font face="仿宋_GB2312"><img border="0" src="downLoadPic.jsp" width="43" height="39"></font></td>
</tr>
</table>
</center>
</div>
</body>
</html>
<%
}catch(Exception e){
out.println("获取图片标题、说明信息失败.");
}
finally{
try{
if(stmt!=null){
stmt.close();
}
if(conn!=null){
conn.close();
}
if(rs!=null){
rs.close();
}
}catch(SQLException sqle){}
}
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -