title: Reading properties file in JSF2.0 which can work in war also
body: <p>To read a <code>properties</code> file in JSF2.0 with Glassfishv3 webserver, which is located at <code>root directory</code> of my web application, I am using below code-</p>
  
  <pre><code>    ServletContext ctx = (ServletContext) FacesContext
              .getCurrentInstance().getExternalContext().getContext();
      String deploymentDirectoryPath = ctx.getRealPath("/");
      Properties prop = new Properties();
      prop.load(new FileInputStream(deploymentDirectoryPath
              + File.separator + "portal-config.properties"));
  </code></pre>
  
  <p>Below is the screenshot of web portal-</p>
  
  <p><img src="https://i.stack.imgur.com/qqLzS.png" alt="enter image description here"></p>
  
  <p>While running the portal I am getting FileNotFound Error, since the file is not present in glassfish domain.</p>
  
  <p>Is there any way to read properties file which can work in both the situations, at development stage and in war file also?</p>