I use the ServletContext when the Servlet loads to get files relatively like
this: context.getResourceAsStream("/WEB-INF/MyPersonalXMLFile.xml")

Shawn

-----Original Message-----
From: Shailesh Barde [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, November 15, 2005 10:21 PM
To: user@struts.apache.org
Subject: Is it Possible!

  
hi,
I want to access myMessegeResources.properties.However, if i try to access
it this way it throws an exception of FileNotFound.However if i give Disk
absolute path then it accesses that myMessegeResources.properties file.
  How to access the relative file in WEB-INF

1)Doesn't Works:-Here i have tried various relative paths to WEB-INF but not
worked!

public class showFilevalues {
public static void main(String args[])throws Exception
    {
      FileReader fr=new FileReader
("/WEB-INF/classes/myMessegeResources.properties");
      BufferedReader br=new BufferedReader(fr);
      String s;
      while((s=br.readLine())!= null){
      System.out.println(s);        }
    fr.close();
      }
}      



This Works:-
public class showFilevalues {
public static void main(String args[])throws Exception
    {
      FileReader fr=new FileReader
("C:/eclipse/workspace/shail/myProjectcontext/WEB-INF/classes/myMessegeResou
rces.properties");
      BufferedReader br=new BufferedReader(fr);
      String s;
      while((s=br.readLine())!= null){
      System.out.println(s);        }
    fr.close();
      }
}      
  Is it Possible to how to access the relative file?

Regards, 
Shailesh
**************************************************************************** 
This email may contain confidential material. 
If you were not an intended recipient, 
Please notify the sender and delete all copies. 
We may monitor email to and from our network. 
****************************************************************************

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to