This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
I just want to know if there's a way to access the properties from a utility class used by an Action class. To access the properties from an Action class we extend the ActionSupport and use the getText("property.key.name") method.
So, my question is -should every other class extend the ActionSupport to access properties, even though its not an Action class? or is there any other way?
Thanks
Vijay
Jimmy Clark
Ranch Hand
Joined: Apr 16, 2008
Posts: 2187
posted
0
A Struts Properties file should be used for Struts-based classes only. Application classes that are not Struts-based should not be using the Struts Properties file. They should use their own Properties file instead.
ocjp 6 — Feeding a person with food is a great thing in this world. Feeding the same person by transferring the knowledge is far more better thing. The reason is the amount of satisfaction which we get through food is of only one minute or two. But the satisfaction which we can get through the knowledge is of life long.
Vijay Ganapathy
Greenhorn
Joined: May 23, 2012
Posts: 13
posted
0
Jimmy Clark wrote:A Struts Properties file should be used for Struts-based classes only. Application classes that are not Struts-based should not be using the Struts Properties file. They should use their own Properties file instead.
Thanks for your reply. So, should I be using a different framework for loading the application properties?
Like Apache commons or Resourcebundle.
I guess, my question is ActionSupport sounds more specific to an Action, is there a generic component within struts that can load not only struts properties, but also application properties.
I'm pretty comfortable and happy that I didnt have to do addl. coding to load props because of ActionSupport but just a little inconvenient to have every class either extend ActionSupport or implement another mechanism to load properties. Does it make sense?
Mohana: I understand how ActionSupport works. Please stop giving obvious answers without understanding the question.
AFAIK, coderanch and stackoverflow are different web sites.
Different web sites are visited by different people.
Different people have different levels of knowledge and different opinions.
Please explain to me whats the problem in cross posting.
Thanks
Jimmy Clark
Ranch Hand
Joined: Apr 16, 2008
Posts: 2187
posted
0
Loading data from a Properties file is relatively easy. I suggest that you first create a class that will load data from a Properties file. Once this class is created and working properly, then you can start to explore other potential options. Good luck!