This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "web app env-entry in web.xml" Watch "web app env-entry in web.xml" New topic
Author

web app env-entry in web.xml

peter cooke
Ranch Hand

Joined: Mar 16, 2004
Posts: 314
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
Bartender

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.


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

Joined: Jan 10, 2002
Posts: 60800
    
  65

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


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

Joined: Mar 16, 2004
Posts: 314
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: http://aspose.com/file-tools
     
    subject: web app env-entry in web.xml
     
    Similar Threads
    ordering of env-entry sub elements
    Ejb Problem
    Injection of Simple Environment Entries Using Annotations
    Adjusting ejb-jar.xml settings with Admin UI
    How to access file in EJB