• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Properties from util classes used by Action

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everyone,

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
 
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 485
Eclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Avoid cross posting Access properties from util classes used by Action
 
Vijay Ganapathy
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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?

 
Vijay Ganapathy
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mohana Rao Sv wrote:Avoid cross posting Access properties from util classes used by Action



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
Posts: 2187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
Mohana Rao Sv
Ranch Hand
Posts: 485
Eclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
https://coderanch.com/how-to/java/BeForthrightWhenCrossPostingToOtherSites
 
Vijay Ganapathy
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mohana Rao Sv wrote:https://coderanch.com/how-to/java/BeForthrightWhenCrossPostingToOtherSites



Thanks. I'll keep that in mind
 
reply
    Bookmark Topic Watch Topic
  • New Topic