I thought about that, Andrew....  After I hit send, of course.  :-)

-----Original Message-----
From: Andrew Hill [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 09, 2003 10:36 AM
To: Struts Users Mailing List
Subject: RE: problem in getproperties.


Maybe thats not the particular property file he is trying to load?

Try using

getServlet().getServletContext().getResourceAsStream( propertyFilePath );

In your actions execute method.

<snip src="javadocs">
This method is different from java.lang.Class.getResourceAsStream, which
uses a class loader. This method allows servlet containers to make a
resource available to a servlet from any location, without using a class
loader.
</snip>

-----Original Message-----
From: Mark Galbreath [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 9 September 2003 22:23
To: Struts Users Mailing List
Subject: RE: problem in getproperties.


Why are you creating a new I/O object when the execute method gets the
resource passed as a parameter argument?

MessageResources properties = getResources( request );
properties.getProperty( key );

Mark

-----Original Message-----
From: deepaksawdekar [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 09, 2003 8:58 AM
To: Struts Users Mailing List
Subject: problem in getproperties.


I am using following code to access the property from properties file in my
action class.
Code snippet is as follows...
..
InputStream in = ClassLoader.getSystemResourceAsStream( propertyFilePath);
properties.load(in);
value = properties.getProperty(key);
....

When I write the main in action class it works fine
but when i copied the same code to execute method, the code does not load
the propertyfilepath file properly even though in both the case class path
and location of file is same.

Am i doing something wrong.


Deepak

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




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


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


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

Reply via email to