|
GenricServlet has two overloaded init methods
1. init(ServletConfig)
2. init()
**** init(ServletConfig) job:
1. it will store the ServletConfig( into a instance variable).
2. it will call init()
Now In our HttpServlet(extends GenericServlet)
we can do initialization in two ways...
1. override init().
-- its recommended way becuase init(ServletConfig) available to this from Generic Servlet will store ServletConfig amd call this overridden init() (remember this is polymorphic call).
2. override init(ServletConfig)
-- this is not recommended. but if we override our we have to call super
implementation of GenericServlet to store the ServletConfig.
like this super.init(ServletConfig).
After that we can do normal HttpServlet specific initializations.
Thanks & Regards, T.Srinivasan
SCWCD 1.4(89%), SCJP 5.0(75%)
Padma priya N.G.
Be the change you want to be - Mahatma Gandhi
Padma priya N.G.
Be the change you want to be - Mahatma Gandhi
Narendra Dhande
SCJP 1.4,SCWCD 1.4, SCBCD 5.0, SCDJWS 5.0, SCEA 5.0
Padma priya N.G.
Be the change you want to be - Mahatma Gandhi
Padma priya N.G.
Be the change you want to be - Mahatma Gandhi
Originally posted by Padma priya Gururajan:
Hi,
When the container sees the servlet entry, will it automatically pass it as a parameter to the init() method?
Thanks in advance.
Narendra Dhande
SCJP 1.4,SCWCD 1.4, SCBCD 5.0, SCDJWS 5.0, SCEA 5.0
Originally posted by Padma priya Gururajan:
When the container sees the servlet entry, will it automatically pass it as a parameter to the init() method?
rgrds,
Khushhal
Padma priya N.G.
Be the change you want to be - Mahatma Gandhi
Originally posted by Padma priya Gururajan:
Hi,
After adding init-param as parameters to the ServletConfig and ServletContext objects, are the ServletRequest and ServletResponse objects created? Or, ServletRequest and ServletResponse objects created before passing as parameters? Which is the order of precedence?
Thanks.
Narendra Dhande
SCJP 1.4,SCWCD 1.4, SCBCD 5.0, SCDJWS 5.0, SCEA 5.0
Padma priya N.G.
Be the change you want to be - Mahatma Gandhi
The ServletRequest and ServletResponse objects are created when container passed the client request to the client. The scope of these objects are limited to the client request.
Padma priya N.G.
Be the change you want to be - Mahatma Gandhi
Narendra Dhande
SCJP 1.4,SCWCD 1.4, SCBCD 5.0, SCDJWS 5.0, SCEA 5.0
Padma priya N.G.
Be the change you want to be - Mahatma Gandhi
Talk sense to a fool and he calls you foolish. -Euripides A foolish tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|