can v create a constructor 4 servlet?

Answer Posted / sanjay sah

Yes, we can create constructor for servlet but that one
should be public no-args constructor.
If we do not create then compiler itself takes care for
it.Servlet container creates instance of servlet by invoking
public no-agrs constructor.

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can we implement a jsp page?

851


What is http servlet? Explain with the help of an example.

787


What mechanisms are used by a Servlet Container to maintain session information?

885


What is the difference between forward () and sendredirect () functions in servlet? Explain

746


How we can call a jsp from the servlet?

712


What are the differences between the servletconfig interface and the servletcontext interface?

838


What is the importance of init() method in Servlet ?

805


Explain the role of dispatcherservlet and contextloaderlistener.

876


What do you mean by scope object and what are its types?

781


How to get ip address in jsp login page and how to validate like 127.1.0.1 all should not be greater than 255

3112


What is the difference between Servlet Request and Servlet Context when calling a Request Dispatcher?

827


What is the difference between get and post methods?

775


Differentiate between get and post?

883


Does servlet have main method?

894


What is called servlet container?

834