1 Reply Latest reply on Dec 23, 2008 5:56 PM by bgoetzmann

    Loading a file from a Seam component

      Hello,


      I'm new to Seam and my question is certainly trivial!


      My Seam web application folder contains a folder named data that contains XML files (data is on the same level as WEB-INF).
      I would like to access to one of these XML file from a Seam component; how can I achieve this without the use of an absolute path ? Is there some application properties I can use?


      Thank you!



      Cheers,


      Bertrand.


      PS: Working a lot with Grails, I'm also impressive by Seam!

        • 1. Re: Loading a file from a Seam component
          Finally I find a solution using this in my Seam component:

          @In
          private FacesContext facesContext

          and in a method:

          ServletContext sc = (ServletContext) facesContext.getExternalContext().getContext()
          String fileName = sc.getRealPath("/data/test.xml")


          Cheers,

          Bertrand.