struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vishal Dalal <vishal.da...@ideacellular.com>
Subject RE: Is it Possible!
Date Wed, 16 Nov 2005 05:06:40 GMT


hi,
sorry. forgot to mention that you would have to take path.lastIndexOf("/")
and then add your relative path

-----Original Message-----
From: Vishal Dalal
Sent: Wednesday, November 16, 2005 10:17 AM
To: 'Struts Users Mailing List'
Subject: RE: Is it Possible!


try using (className.class).getResource("NameOfResourceInFolder");
it returns a URL
get path from String path = URLName.getPath();
and then,
add your relative path to the path returned

-----Original Message-----
From: Shailesh Barde [mailto:shailjava@rediffmail.com]
Sent: Wednesday, November 16, 2005 9:51 AM
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

Make your callers hear anything you like.Call 456 say DIALER TONES.

An idea can change your life.

************** LEGAL DISCLAIMER ************
This E-Mail may contain Confidential and/or legally privileged Information and is meant for
the intended recipient(s) only. If you have received this e-mail in error and are not the
intended recipient/s, kindly notify us at mailadmin@ideacellular.com and then delete this
e-mail immediately from your system. You are also hereby notified that any use, any form of
reproduction, dissemination, copying, disclosure, modification, distribution and/or publication
of this e-mail, its contents or its attachment/s other than by its intended recipient/s is
strictly prohibited and may be unlawful.

Internet Communications cannot be guaranteed to be secure or error-free as information could
be delayed, intercepted, corrupted, lost, or contain viruses. IDEA Cellular Limited does not
accept any liability for any errors, omissions, viruses or computer problems experienced by
any recipient as a result of this e-mail.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message