File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes web app env-entry in web.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "web app env-entry in web.xml" Watch "web app env-entry in web.xml" New topic

web app env-entry in web.xml

peter cooke
Ranch Hand

Joined: Mar 16, 2004
Posts: 317
I am a beginner, sorry for dumb question.

Using the WSAD it appears the env-entry tag is supposed to be used for defining @ deployment time application (scope) wide string values. Am I correct? If not what should I use?

If correct how would I retreive the value specifed in env-entry from within a struts action? (my google searchs are not returning anything useful)

CIAO Peter M. Cooke
Nathan Pruett

Joined: Oct 18, 2000
Posts: 4121

The env-entry actually gets stored in JNDI, so you'd have to access it just like looking up an EJB Home interface - create an initial context; look up the env-entry name; cast the value to the appropriate class.

You can find more information on using environment variables about halfway through this article on Sun's website.

Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63532

You might also investigate context parameters which are a little more straight-forward (no JNDI).

[Asking smart questions] [About Bear] [Books by Bear]
peter cooke
Ranch Hand

Joined: Mar 16, 2004
Posts: 317
Ok now I have 2 methods (context parameters and JNDI lookup)
Which is going to have a worse BigO value(be a more expensive opperation).

  • use the request to search through the Session and ServletContext to get the value of a variable
  • look up the value in JNDI

    I agree. Here's the link:
    subject: web app env-entry in web.xml
    It's not a secret anymore!