📄 image.jsp
字号:
<%@ page contentType="text/html; charset=GBK" %>
<%@ page language="java"%>
<%@ page import="java.sql.*" %>
<%@ page import="java.util.*"%>
<%@ page import="java.text.*"%>
<%@ page import="java.io.*"%>
<html>
<head>
</head>
<body>
<jsp:useBean id="j" scope="application" class="jdbc.jdbc"/>
<%
String image=(String)session.getValue("image");
try{
Connection con=j.getConnection();
Statement statement=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
String sql="select tour_line_image from tour_line_info where tour_line_name='"+image+"'";
ResultSet r=statement.executeQuery(sql);
while(r.next())
{
InputStream in = r.getBinaryStream("tour_line_image");
response.setContentType("image/jpeg");
ServletOutputStream sout = response.getOutputStream();
byte b[] = new byte[1024];
int length = 1024;
while((length = in.read(b)) != -1){
sout.write(b,0,length);
}
sout.close();
r.close();
}
j.releaseConnection(con);
}
catch(SQLException ee){out.print("数据库连接失败!");}
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -