http://www.csdn.net/oldexpert/TopicView.asp?id=83096&table=200101
解决方案 »
- struts2下载文件问题
- 毕设做一个基于WEB的软件测试管理系统,如何捕获需求?
- 高手请进,关于调用WebServices出现的问题
- JFreeChart画柱状图时小数点位数和柱子宽度如何控制?
- 如何让提交表单时不打开新窗囗而直接在本窗囗打开
- 在线坐等maven大牛解决部署问题
- 部署在tomcat中的java项目如何导入eclipse中,如何让他跑起来?
- 又一调试时报的错误,请高手指教下~~
- 关于RecordSet的问题,急急急急急急急!
- 分儿多多!jsp调用javabean老是报Unclosed jsp:useBean tag错误!
- 怎样弹出一个小小的警告窗口(包含确定键)
- throws 这个关键字是什么意思???
/**
* 文 件 名:showcoverphoto.jsp
* 显示封面图片
* 输入参数:bookid.
*/
%>
<%@ page contentType="image/gif;charset=gb2312" %>
<%@ include file="/include/initanonymousportal.jsp"%>
<%@ page import="java.sql.*"%>
<%@ page import="java.io.*"%>
<%@ page import="com.chinabook.module.content.ContentFactory"%>
<%@ page import="com.chinabook.module.content.Book"%>
<%@ page import="com.chinabook.util.web.ParamUtils"%>
<%!private void showImg(InputStream ins,javax.servlet.http.HttpServletResponse response){
try{
byte[] buffer = new byte[8000];
int index=0;
int len;
javax.servlet.ServletOutputStream out = response.getOutputStream();
while((len=ins.read(buffer,index,8000))!=-1){
out.write(buffer,0,len);
}
out.flush();
out.close();
}catch(java.io.IOException e){}
}
%>
<%
//获取参数
int bookId=ParamUtils.getIntParameter(request,"bookid"); com.chinabook.module.content.ContentFactory
contentFactory = portal.getContentFactory();
com.chinabook.module.content.Book book
= contentFactory.getBook(bookId);
java.io.InputStream inStream = book.getCoverPhoto();
if(inStream==null){
inStream = new java.io.FileInputStream(new File("/opt/orion/default-web-app/upload/CoverNo.gif"));//
}
showImg(inStream,response);
try{
inStream.close();
}catch(java.io.IOException e){ }
%>