Can we write a constructor for a Servlet class ? if yes how ?
if no why not ?

Answer Posted / narayana rao dasari

yes.....! we can write constructor for servlet class why
because every java class allows construction initialization
if we do not write constructor explicitly it will call
default constructior.

If we call our own constructiors means we will not able to
access the servelet config objects so better wat is to
intializeing in init() method......thank u,
Narayan

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is Servlet API used for connecting database?

622


What is difference between the HTTP Servlet and Generic Servlet? Explain about their methods and parameters?

617


What is ServletConfig object?

612


What are the types of servlet?

669


What do you mean by chaining in servlet?

576






What are some disadvantages of storing session state in cookies?

592


Explain web application directory arrangement?

593


How can we implement a jsp page?

632


Explain the role of dispatcherservlet and contextloaderlistener.

610


What is the life cycle of a servlet?

791


What do you mean by the servlet chaining?

549


Which application server is best for java?

560


What are the new features added to servlet 2.5?

594


What’s the difference between sendredirect and forward methods

568


What are the supporting protocol by HttpServlet ?

659