1 2 Previous Next 17 Replies Latest reply on Apr 28, 2009 9:53 PM by Serhiy Zastavnyy

    [Tree] how to download file on nodeSelectListener

    Lotfi Mellouk Master

      Hi,

      I'd like to dowload file on a new windows on nodeSelectListener, the file is opened on the browser..

      this is not reproduced when I do downlaod on h:commandButton, it seems related to ajax requests.

      here a snipped code for download:

      
      response.setContentType("application/octet-stream");
       response.setHeader("Content-Disposition", "attachment; filename=" + file.getName() + "");
       OutputStream out;
       try {
       out = response.getOutputStream();
      
       out.write(file.getContent());
       out.close();
       context.responseComplete();
       } catch (IOException e) {
      
       e.printStackTrace();
       }
      



      best regards!



        1 2 Previous Next