ServeltConfig Object uses

Discussions

Web tier: servlets, JSP, Web frameworks: ServeltConfig Object uses

  1. ServeltConfig Object uses (1 messages)

    hi dear,
    can anyone tell me abt if i have a init() method in servlet
    I sometimes pass ServletConfig object.
    I know theortically it saves and can be used latter on.

    But can anyone give me ex exatly where and when we use it in servlet

    Regards
    sukhbir
  2. ServeltConfig Object uses[ Go to top ]

    yeah, u mentioned generally we do the following coding in the servlets...

    private ServletConfig config;

      public void init (ServletConfig config)
        throws ServletException {
        this.config = config;
      }

    We, assign the config object to global config variable...

      We do so,

    1. The config object contains initialization parameters, which are a set of name/value pairs, and a ServletContext object, which gives the servlet information about the server.

    2. The servletcontext object is basically hlep for servlet-servlet communication using RequestDispatcher...

    --kumar