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

routing - AngularJS State management ->load multiple states in one page -

python - GRASS parser() error -

post - imageshack API cURL -