Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

web app env-entry in web.xml

 
peter cooke
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64851
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might also investigate context parameters which are a little more straight-forward (no JNDI).
 
peter cooke
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

  •  
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic