How to define/retrieve an application specific parameter in an J2EE application

I would like to define a application specific variable.  When the application start up, I can load it into some context variable.  Then, some java bean can access these context and do something with the defined variable.  Is there any way to do it?
jaxoxAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rrzCommented:
>define a application specific variable.  
You could define one in your web app's web.xml ;
<context-param>
                          <param-name>name</param-name>
                          <param-value>jaxox</param-value>
</context-param>  
On a JSP, you could access with
String name = application.getInitParameter("name");
>Then, some java bean can access these context and do something with the defined variable  
(I think you are talking about a javabean here,not a EJB. Please confirm.)
That will take some more work. Please read jim's solution and my assisted solution at  
http://www.experts-exchange.com/Programming/Languages/Java/J2EE/JSP/Q_21811332.html   
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sunray_2003Commented:
You can edit your server startup script and in the line when you start the server you can add -D params. -Dkey="Value". Inside your webapp or services or Jsp's you can get the parameter by System.getProperty("key")
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java EE

From novice to tech pro — start learning today.