Servlet's init() method

Discussion in 'Java' started by gandhi.pathik@gmail.com, Feb 15, 2006.

  1. Guest

    hi guys,

    It is recommended that if we are using servlet's

    public void init(ServletConfig config) throws ServletException method
    for initialization

    then we should use

    super.init(config) ;

    as a first line in the code..like as below.

    public void init(ServletConfig config)
    throws ServletException {
    super.init(config);

    }

    if anyone has idea then pl. let me know exact reason why i should need
    to call super.init(config)..

    Thanks and Regards,
    Pathik s Gandhi
    , Feb 15, 2006
    #1
    1. Advertising

  2. To save the ServletConfig parameter so that the getServletConfig()
    method can return the value (this is implemented in
    GenericServlet.init()).

    Regards
    Jean-Francois Briere, Feb 15, 2006
    #2
    1. Advertising

  3. On 14 Feb 2006 20:42:21 -0800,
    <> wrote:

    > hi guys,
    >
    > It is recommended that if we are using servlet's
    >
    > public void init(ServletConfig config) throws ServletException method
    > for initialization
    >
    > then we should use
    >
    > super.init(config) ;
    >
    > as a first line in the code..like as below.
    >
    > public void init(ServletConfig config)
    > throws ServletException {
    > super.init(config);
    >
    > }
    >
    > if anyone has idea then pl. let me know exact reason why i should need
    > to call super.init(config)..
    >
    > Thanks and Regards,
    > Pathik s Gandhi
    >


    This is all covered in detail in the JavaDocs for GenericServlet and
    HttpServlet - anybody serious about servlet development should have
    them on hand.

    Bill
    William Brogden, Feb 16, 2006
    #3
    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. Tony Cheng
    Replies:
    1
    Views:
    8,186
    Juan T. Llibre
    Feb 24, 2006
  2. Stephan Koser
    Replies:
    3
    Views:
    28,359
  3. Replies:
    8
    Views:
    886
    John C. Bollinger
    Mar 4, 2005
  4. Mitch
    Replies:
    2
    Views:
    543
    Mitch
    Mar 13, 2006
  5. crack_cs
    Replies:
    5
    Views:
    9,817
    Thomas Fritsch
    Mar 17, 2006
Loading...

Share This Page