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

Answer Posted / abhishek taneja

yes offcourse you can write a constructor for a servlet
after all it is a java class. you can simply provide but if
u do not provide then it is by default include the no
argument constructor that is used by the Init() method in
the servlet life cycle.

Is This Answer Correct ?    11 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why do we have servlet listeners?

836


How can we upload the file to the server using servlet?

782


What are sessions in servlets?

827


What is called servlet container?

864


What is the inter-servlet communication?

952


How can we implement a jsp page?

882


What are all the ways for session tracking?

864


What are the features added in Servlet 2.5?

996


What does the term localization refer to?

819


What are different ways for servlet authentication?

809


What is the purpose of dispatcherservlet properties?

749


how to link html file to sevlet file.one name is textbox,c&c++ is cheakbox,bc&mca is radio button and one submit buttonis ok why in this programme use in servelt file

2362


List out difference between a JavaBean from a Servlet?

776


What exactly are the functions of servlet?

847


What is the procedure of invoking different servlet in a different application?

795