How do I employ a "deployment descriptor" for a Java business class in both stand-alone and servlet context
Posted on 2007-11-19
I am attempting to build my first Java application, with an initial goal of making it a web app. I have followed the MVC convention and placed all of the business logic in a separate class (the Model). I am unclear how to create a configuration file for this Model class for things like datasource information. In my research it has been very clear how configuration works for servlets (a deployment descriptor: web.xml). What isn't clear is how I can utilize some similar configuration scheme for the Model class, such that it will work when deployed as part of a servlet app but also as a class included by a non-web Java app (such as the test harness I built for the Model class). It seems I could use web.xml for the model class when it is part of a servlet, but then how would it work in a standalone app? The ideal solution won't make me use two different methods for using the class in a servlet vs in a standalone app.