You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Dua, Amit" <AD...@wellington.com> on 2001/11/14 21:10:40 UTC
properties file in action class
Hi
if I have to load a properties file in my action class.
I can do it in perform method.
But I want to do it in init of Action Servlet , so that it does not get
loaded every time a call is made to the action class.How can I do this.
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: properties file in action class
Posted by "Trever M. Shick" <ts...@objectwave.com>.
You could load it via a singleton... For example if you need to load a
different properties file depending upon the Action class, your Singleton's
interface would look like this:
public class PropertyLoader {
public static synchronized PropertyLoader getInstance();
public void load(String actionClassName, String propertyFile)
public Properties get(String actionClassName)
}
The singleton could utilize a Map to store the properties loaded with a key
of "actionClassName".
Load would only load if it hadn't previously been loaded (properties file)
And get would simply return the properties object from the map...
Trever
----- Original Message -----
From: "Dua, Amit" <AD...@wellington.com>
To: "'Struts Users Mailing List'" <st...@jakarta.apache.org>
Sent: Wednesday, November 14, 2001 1:10 PM
Subject: properties file in action class
>
> Hi
> if I have to load a properties file in my action class.
> I can do it in perform method.
> But I want to do it in init of Action Servlet , so that it does not get
> loaded every time a call is made to the action class.How can I do this.
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>