| This Chapter | |
| - | Chapter 14: The Config Object |
| - | Using the web.xml File or Properties Files |
| - | The Config Object |
| - | Summary |
Many parts of a J2EE application need some dynamic configuration information that can be edited easily. For example, database operations need the data source name and the user credentials, the presentation and other layers require a common date pattern for parsing and displaying dates, etc. Information can be stored in the deployment descriptor (the web.xml file) or a properties file. However, while the values in the deployment descriptor can be accessed from JSPs and Struts action object, they are not visible from other parts of the application, such as a business object. The same problem exists with employing a properties file. For the properties file to be useful, you need a file reader that can be accessed from all parts of the application.
This chapter proposes a novel approach that is simple enough to implement: by creating a Singleton Config object. But first, let’s review using the web.xml file or properties files in more detail.