Well, I have never used the getRealPath(
String) method, but I have used other methods of ServletContext from our Action classes (execute method) using that construct.
Remember, that was for struts 1.1. You'll need to make sure you can do this for whatever version you are using.