title: How can one read a text file in a Struts 2 app
body: <p>Developing a Struts 2 app I run in a following problem. I need to read a text file that is deployed in web server with my app. How can I access it knowing its relative path. In other words how can I find absolute path if I know relative path inside the deployed directory.
  When I had similar problem with servlets I used to use this.getContextPath() (or something similar) that returned an absolute path to the folder in the webserver.</p>
  
  <p>EDIT:
  Thank you guys for answer. For me worked this:</p>
  
  <pre><code>String path=GetPointsOfInterestAction.class.getResource("../../../resources/visitor_attractions.txt")
  </code></pre>
  
  <p>Could you please explain why I it worked because I'm making first steps in java.</p>