<%@ page contentType=text/html;charset=gb%>
<%@ page import=javasql* %>
<%@ page import=javautil*%>
<%@ page import=javatext*%>
<%@ page import=javaio*%>
<jsp:useBean id=conn scope=page class=dbconnDBResult/>
<%
String path = requestgetContextPath();
String basePath = requestgetScheme()+://+requestgetServerName()+
:+requestgetServerPort()+path+/;
%>
<!DOCTYPE HTML PUBLIC //WC//DTD HTML Transitional//EN>
<html>
<head>
<base href=<%=basePath%>>
<title>My JSP testimageoutjsp starting page</title>
<meta httpequiv=pragma content=nocache>
<meta httpequiv=cachecontrol content=nocache>
<meta httpequiv=expires content=>
<meta httpequiv=keywords content=keywordkeywordkeyword>
<meta httpequiv=description content=This is my page>
<!
<link rel=stylesheet type=text/css href=stylescss>
>
</head>
<body>
<%
int id= IntegerparseInt(requestgetParameter(picid));
String sql = select pic from p WHERE picid=+id;
ResultSet rs=conngetResult(sql);
while(rsnext())
{
ServletOutputStream sout = responsegetOutputStream();
//图片输出的输出流
InputStream in = rsgetBinaryStream();
byte b[] = new byte[xa];
for(int i = inread(b); i != ;)
{
soutwrite(b);
//将缓沖区的输入输出到页面
inread(b);
}
soutflush();
//输入完毕清除缓沖
soutclose();
}
%>
</body>
</html>
[] [] [] []