修改fck源代码(2)

showImage.jsp代码如下:

<%

    try {

 

       out.clear();

       response.reset();

       response.setContentType("image/jpeg");

 

       //不缓存

       response.addHeader("pragma", "NO-cache");

       response.addHeader("Cache-Control", "no-cache");

   

       //获得主键id

       String id = request.getParameter("fileId") == null ? ""

              : request.getParameter("fileId");

      

      

       FCKImageDAO fckImageDAO = new FCKImageDAO();

       FCKImage fckImage = fckImageDAO.findById(id);

 

       InputStream inputStream = fckImage.getPictureContent();

      

       byte[] buffer = new byte[1000];

       int bytesum = 0;

       int byteread = 0;

       while ((byteread = inputStream.read(buffer)) != -1) {

           bytesum += byteread;

           response.getOutputStream().write(buffer, 0, byteread);

       }

       inputStream.close();

       response.getOutputStream().flush();

      

       System.out.println("调用FCK输出图片流");

 

    } catch (Exception e) {

       out.println();

    }

%>

这样以流形式输出图片的需求基本完成,按照以上方式修改基本上可以解决大部分fckeditor的本地化修改方案。

2010年要过去了,2011就要来了。Happy New Year

你可能感兴趣的:(jsp,cache,fckeditor)