title: best approach to implement getRealPath()
body: <p>I am working on struts 2.0 . I am designing a web application.
  I am using Jasper Report in my application. I want to access the <code>*.jrxml</code> files in my action class. I don't want to give hard coded path to the files. So to get the path dynamically I googled it and got the solution that I can get the path using <code>getRealPath()</code> method. But I found two implementation of doing this:</p>
  
  <ol>
  <li><p>Using <code>HttpSession</code> to get object of <code>ServletContext</code> and using the <code>getRealPath()</code> method of the <code>ServletContext</code> object. 
  Like this:</p>
  
  <pre><code>HttpSession session = request.getSession();
  String realPath = session.getServletContext().getRealPath("/");
  </code></pre></li>
  <li><p>The second approach to do it directly using the static method <code>getServletContext()</code> of <code>ServletActionContext</code>. And then we can get the real path of the application using the <code>getRealPath()</code> method. 
  Like this:</p>
  
  <p><code>String realPath = ServletActionContext.getServletContext().getRealPath("/");</code></p></li>
  </ol>
  
  <p>Please tell me, is there any difference between the above two and also please tell me whether there is any other way to get the path?</p>