2012-08-24 71 views

回答

1

我设法做到这一点的这个代码几行: 只是添加到您的行动:

OutputStream out = response.getOutputStream(); 
     response.setContentType("application/rtf"); 
     FileInputStream in = new FileInputStream("your_file_path"); 
     byte[] buffer = new byte[4096]; 
     int length; 
     while ((length = in.read(buffer)) > 0){ 
      out.write(buffer, 0, length); 
     } 
     in.close(); 
     out.flush(); 
+1

您还需要设置内容部署和文件名,并返回一个'ActionForward'的'null'代替的Struts知道响应在行动中处理。那肯定是Struts的旧版本。 –

+0

是的,但对于actionForward,为什么不可能调用它?因为在我的动作中,我改变了数据库中的数据,并希望返回我的jsp来显示新的数据....任何方式? – fatiDev

+0

我不知道你在问什么。 –

相关问题