1 Reply Latest reply on Oct 24, 2001 4:32 AM by J. Wolfgang Kaltz

    Abstracting the new IntialContext(props) process

    Peet Denny Newbie

      When using several JSPs and Servlets in the same app, what's the best way to abstract the process of creating a new initial context, to save re-doing the
      Hashtable props = new Hashtable();
      thing in every class/page?
      I thought of having the properties Hashtable stored in the ServletContext, so I could say:
      ....new InitialContext(context.getAttribute("meInitProperties"));
      Any other thoughts?

        • 1. Re: Abstracting the new IntialContext(props) process
          J. Wolfgang Kaltz Novice

          What I have, is one controller / login servlet which has servlet parameters for these properties and creates the InitialContext. This servlet also creates an object I call user handle which contains user information + the Context; and stores this object in the HttpSession.
          All other servlets (which live in the same environment) retrieve this handle and use its Context. It's not necessary to store the Hashtable, if you have the Context.