ObjectWeb Consortium
Search ObjectWeb Mail Archive: 

Advanced Search - Powered by Google


Mail Archive Home | enhydra List | September 2004 Index

<--  Date Index  --> <--  Thread Index  -->

RE: [enhydra] reading a config value


Hi,

If this is an Enhydra Application (sublassed from StandardApplication)
there are a few ways to do this.

1. One way is by adding static variables to your Main Application class.

For example:

Class MyApplication extends StandardApplication {

   public static String myConfigValue;

     public void startup(Config appConfig) throws ApplicationException {
        // Here is where you would read application-specific settings
from
        // your config file.
        super.startup(appConfig);
        try {
           myConfigValue =
appConfig.getString("MyApplication.MyConfigValue");
        catch ....

In your other classes you can acces the config value:

        MyApplication.myConfigValue             


2.  Or if you use HttpPresentationObjects you can read the value using
the HttpPresentationComms variable:
        The comms variable is passed to the run() method of
HttpPresentation objects.
        
        If you are using a BasePO object, you can save the comms
variable and make it available to all your 
        presentation objects sub-classed from BasePO. 
        

        Using the HttpPresentationComms variable to access config
values:

         String v =
myComms.application.getConfig().getString("MyApplication.MyConfigValue")
;


Hope this helps,
Mike.



-----Original Message-----
From: Jeremy Ashcraft [mailto:jashcraft@xxxxxxxxxx] 
Sent: Tuesday, September 07, 2004 8:19 AM
To: enhydra@xxxxxxxxxxxxx
Subject: [enhydra] reading a config value


I'd like to be able to access a value from the application config file 
(cm.conf) inside of a servlet.  Any ideas on how I can accomplish this?

-- 
jeremy ashcraft
operations/development
EDucation GATEways
jashcraft@xxxxxxxxxx





<--  Date Index  --> <--  Thread Index  -->

Reply via email to:

Powered by MHonArc.

Copyright © 1999-2005, ObjectWeb Consortium | contact | webmaster.