1 Reply Latest reply on Jul 4, 2007 8:52 PM by Viet

    SaveAs CSV file

    Chua Khoon Yong Novice


      I was working on Jboss portal 2.4.1SP1 and using Seam 1.2.1GA.

      Recently i got a request to create a button on a portal page that allow the user to generate a csv file. Thats mean the user click on the button and the web browser would prompt the user to save "some content" as a CSV file. "Some content" can be generated by stateless bean refer to by the button "action".

      Is it possible to use facelets to prompt the user to "saveas" the CSV file in portal environment?

      Any advice please.

      Thank you.

        • 1. Re: SaveAs CSV file
          Viet Master

          You can put a servlet in the war file of your web application and create a link by doing :

          ExternalContext ctx = FacesContext.getCurrentInstance().getExternalContext();
          String s = ctx.getRequestContextPath() + "/mydownloadservlet";
          String url = ctx.encodeResourceURL(s);

          Then use the URL in your application.