I wonder if anyone could advise a Java webapp question?
I have a standard standard Java class that has methods for setting and getting property file values. These methods are used in the system area and are called by servlets and class methods without a servlet.
But I would like to use ServletContextListener to set the paths to the properties file around the world, and not to hard-code them or save them to the database.
ServletContextListener can be used to set global variables for servlets with context.setAttribute ("PROP_FILE_PATH", "C: \ ..."). But is there a way to access these variables outside of servlets, or can ServletContext servlets access external servlets?
I do not think that passing ServletContext as a parameter to the class method I should receive and setting the values of the properties file would be a viable option due to the number of calls.
thanks
Martin
Martin
source
share