• 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
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Better idea to put custom properties in struts 1.2

 
Ranch Hand
Posts: 91
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can anyone please suggest me a best practice for custom properties in struts 1.2, I mean where to place the properties file (under WEB-INF or somewhere else) and how to access or address them relatively from struts Action class.

 
Ranch Hand
Posts: 385
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I put the property file in a particular place where i used to put all the property file for different appliation.

lets say

C:
|---- PropertyFiles
|----App1
|--app1.properties
|-----App2
|--app2.properties


Note : the above paths are not intended appropriately
Then in the server(Application or webserver) configuration ,i pass the path to the property file as system property via JVM argument.
like -DAPP2Prop=path to app2.properties -DApp1Property=path to app1.properties.

Then whn you run the application you can read it as System.getProperty(App2Prop) and pass it to the argument as Property constructor.

Well i am not sure this is a good idea or not? But this works atlease for me so far.
 
Muthukrishnan Manoharan
Ranch Hand
Posts: 91
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Siva Masilamani

But I need to package the properties file along with the war.. So I would like to know where should I drop the file in WEB-INF or somewhere else and how can I access it relatively in Action class...
 
Siva Masilamani
Ranch Hand
Posts: 385
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check out here

webpage
 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The best place to put a property file in a WebApp (WAR/EAR file) would be in the src folder.

The ideal demarcation would be like this:

src
- java
- config
- resources

Now place all the property files under the resources section. The config is mainly for xml files.

You can now pick up the property using a classpath resource loader or even using struts property loader.
 
reply
    Bookmark Topic Watch Topic
  • New Topic