0 Replies Latest reply on Oct 7, 2011 3:40 AM by Sudharma Puranik

    content disposition with attachment doesnt work for AJAX response

    Sudharma Puranik Newbie

      The problem for me is pretty straight forward. Onclick of an anchor tag , I execute a javascript using a4j:jsFunction and the action of  this function should stream an XML file from server. The problem is , the stream sent on richfaces response doesnt give a saveAs dialog but instead renders the xml on the browser. After reading many articles I understood that Ajax response cannot give a saveAs Dialog.


      xhtml snippet:


      <a4j:jsFunction name="updateCart" reRender="idFavouritePanel">
      <a4j:actionparam name="jsonObject" assignTo="#{archiveOrderBean.jsonObject}"/>

      <a4j:jsFunction  name="download" reRender="partTableId" action="#{archiveOrderBean.loadSelectedOrder}">
      <a4j:actionparam name="strId" assignTo="#{archiveOrderBean.strId}"  />


      and the response from bean



      .addHeader("Content-Disposition", "attachment; filename=" + attr.getUrl());
      //                  writer.write(byteArr.toString());
      //                  writer.flush();
      // post(trueStr,encPath,encUrl,trueStr,response);


      any help in this regard will be really helpful.