🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: cn.bbs.comp.lang.java
Article #12388

jsp�д�access��ݿ��ȡͼƬ���⣡��������

#12388
From: sona
Date: Tue, 27 Jul 2004 07:05
31 lines
2157 bytes
jspԴ�������£�
<%@ page contentType = "image/gif" %>
<%@ page import="java.sql.*,java.io.*,javax.naming.*" %>
<jsp:useBean id="vps" class="vps.vps"/>
<%
java.sql.ResultSet rs;
rs = vps.executeQuery("SELECT data FROM pic where id='1'");
if(rs.next()){
        ServletOutputStream outStream = response.getOutputStream();
        InputStream inStream = rs.getBinaryStream(1);
        byte b[] = new byte[1024];
        while(inStream.read(b) != -1){
            outStream.write(b);
        }
        outStream.flush();
        outStream.close();
        inStream.close();
    }
%>
���У�vpsΪ��ȡ��ݿ��javabean;
pic���У��ֶ�id|data;
��������http://218.193.186.42:8080/vpss/1.jsp
ΪʲôͼƬ��ʾ������������ְ�æ����


--
�� Ҫ���������Բ�ס����
   Ҫ����������������
 Ҫ������������������
 Ҫ����������������ɢ
�� ��Դ:����ˮ˼Դ bbs.sjtu.edu.cn��[FROM: 218.193.186.42]
Technical Details
Message-ID: <4DODlB$9qV@bbs.sjtu.edu.cn>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!border1.nntp.dca.giganews.com!nntp.giganews.com!nntp-server.pubsub.com!maily.cic.tsinghua.edu.cn!netnews.sdu.edu.cn!SJTU

Show Full Headers
Complete Article Headers
X-Google-Thread: f6cb0,dff8f13ed619a82e,start
X-Google-Attributes: gidf6cb0,public
X-Google-Language: Chinese,GB
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!border1.nntp.dca.giganews.com!nntp.giganews.com!nntp-server.pubsub.com!maily.cic.tsinghua.edu.cn!netnews.sdu.edu.cn!SJTU
From: sona.bbs@bbs.sjtu.edu.cn (sona)
Newsgroups: cn.bbs.comp.lang.java
Subject: jsp�д�access��ݿ��ȡͼƬ���⣡��������
Date: 27 Jul 2004 07:05:00 GMT
Organization: ��ˮ˼Դ
Message-ID: <4DODlB$9qV@bbs.sjtu.edu.cn>
Mime-Version: 1.0
Content-Type: text/plain; charset="gb2312"
Content-Transfer-Encoding: 8bit
X-Filename: Java/M.1090911707.A
Lines: 31