java - Why we can't call servlet constructor instead of init method to initialize the config parameters? -


this question has answer here:

why can not call servlet constructor instead of init method initialize config parameters?

by specification:

the lifecycle of servlet controlled container in servlet has been deployed. when request mapped servlet, container performs following steps.

if instance of servlet not exist, web container

  1. loads servlet class.

    1.1. creates instance of servlet class.

    1.2. initializes servlet instance calling init method. initialization covered in creating , initializing servlet.

  2. invokes service method, passing request , response objects. service methods discussed in writing service methods.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

dataset - MPAndroidchart returning no chart Data available -

post - imageshack API cURL -