Re: servlets - application level object

Discussion in 'Java' started by Wendy S, Jul 1, 2003.

  1. Wendy S

    Wendy S Guest

    Miguel De Anda wrote:

    > Is there some application level object that I can use to store settings
    > such as database connection info and directory settings? I need something
    > that is at least readable throughout my servlets (writing settings after
    > initialized is not important).


    Yes. Set up a ServletContextListener and have it do whatever you need when
    the servlet context (the webapp) is loaded.

    http://java.sun.com/products/servlet/2.3/javadoc/javax/servlet/ServletContextListener.html

    I have mine load a bunch of HashMaps into application scope. They are later
    used to populate drop-down select lists on HTML forms.

    --
    Wendy in Chandler, AZ
    "BTW, Lucifer just called and he needs a pair of ice skates :)"
    James Turner on struts-dev, voting to release Struts 1.1 Final
    Wendy S, Jul 1, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    2
    Views:
    428
  2. Phil Hanna
    Replies:
    0
    Views:
    708
    Phil Hanna
    Jul 2, 2003
  3. John C. Bollinger

    Re: servlets - application level object

    John C. Bollinger, Jul 2, 2003, in forum: Java
    Replies:
    2
    Views:
    1,726
    John C. Bollinger
    Jul 2, 2003
  4. pabbu
    Replies:
    8
    Views:
    708
    Marc Boyer
    Nov 7, 2005
  5. Jéjé
    Replies:
    0
    Views:
    221
    Jéjé
    Sep 27, 2005
Loading...

Share This Page