File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes OO, Patterns, UML and Refactoring and the fly likes where is the best place to put the global parameter? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "where is the best place to put the global parameter?" Watch "where is the best place to put the global parameter?" New topic
Author

where is the best place to put the global parameter?

zb cong
Ranch Hand

Joined: Jan 14, 2002
Posts: 416
hello:
i am now studying the petstore1.3,and find that the global parameters are kept in the servlet context,i wonder if it is a good solution.in my project,i seldom use the servlet context,session context etc,i feel more like to put the global parameter in a singleton that is loaded when the app is started. i don't know where is the best place to put the global parameter,servlet context or singleton?
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
I would go with the servlet context (also known as application context). More importantly, I would also encapsulate access to it into a single place, for example by providing a getter method in the base class for all my servlets.


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: where is the best place to put the global parameter?