不建议使用JSP做直接对象流的输出。请用Servlet重新实现。

解决方案 »

  1.   

    首先,JSP已经内置了out对象,因此你不能再通过response.getOutputStream()再获得一个fout对象了。你应该直接使用out对象。
    然后要设置JSP中内置response对象的ContentType,不应该显示的调用setContentType(),而应该通过JSP标记:<%@ page contentType="image/gif" %>