用流读取幻灯片报java.lang.IllegalStateException,不知哪有问题?

后台查出一个List:[{KEYID=1495, TITLE=mm, FILEURL=uploadfile/webmanagefiles/2012216/201202161449470000562.bmp},
{KEYID=1535, TITLE=whmtest0216-1, FILEURL=uploadfile/webmanagefiles/2012216/201202161427270000440.jpg},
{KEYID=1515, TITLE=m2, FILEURL=uploadfile/webmanagefiles/2012216/201202161112260000125.bmp},
{KEYID=1479, TITLE=whmtest02-14-3, FILEURL=uploadfile/webmanagefiles/2012214/201202141620580000593.gif},
{KEYID=1478, TITLE=whmtest0214-2, FILEURL=uploadfile/webmanagefiles/2012214/201202141619290000953.jpg}]

jsp页面接受这个List

function showTopFocusNew(list){
      $.each(list,function(index,obj){ 
       imgUrl[index+1] = $("base:first").attr("href") + 'infonet/infonet_picDetail.action?filepath='+obj.FILEURL;
       imgtext[index+1] = obj.TITLE;
       imgLink[index+1] = $("base:first").attr("href") + 'infonet/infonet_infoDetail.action?webContent.keyid='+obj.KEYID;
       imgAlt[index+1] = obj.TITLE;
   });
  }

根据路径(本地硬盘上,不是tomcat下)读取图片 imgUrl[index+1] = $("base:first").attr("href") + 'infonet/infonet_picDetail.action?filepath='+obj.FILEURL;


public void picDetail() throws Exception{
   OutputStream myout=response.getOutputStream();
   BufferedInputStream buff = null;
   try {   
   String fileurl=request.getParameter("filepath");
   request.setCharacterEncoding("utf-8"); 
   //创建file对象
         File file=new File(request.getSession().getServletContext().getInitParameter("uploadFilePath")+ "/"+fileurl.trim());
         if(!file.exists())
          file= new File(ServletActionContext.getServletContext().getRealPath("/")+fileurl.trim());
            //写明要下载的文件的大小
         response.setContentLength((int)file.length());     
         //读出文件到i/o流
         FileInputStream fis=new FileInputStream(file);
         buff=new BufferedInputStream(fis);
         byte [] b=new byte[1024]; 

        long k=0         
         //开始循环下载
         while(k<file.length()){
             int j=buff.read(b,0,1024);
             k+=j; 
             myout.write(b,0,j);
         } 
      }catch (Exception e) {
         e.printStackTrace();
          }finally{
            if(null != buff) {           
            buff.close();
     }
          
           if(null !=  myout) {           

            myout.flush();
            myout.close();

      }
          }
  }

报错:不知怎么回事,哪里有问题呢???

严重: Servlet.service() for servlet default threw exception
java.lang.IllegalStateException
 at org.apache.catalina.connector.ResponseFacade.sendError(ResponseFacade.java:407)
 at org.apache.struts2.dispatcher.Dispatcher.sendError(Dispatcher.java:752)
 at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:505)
 at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
 at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
 at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:864)
 at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
 at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1665)
 at java.lang.Thread.run(Thread.java:619)

你可能感兴趣的:(用流读取幻灯片报java.lang.IllegalStateException,不知哪有问题?)