can v create a constructor 4 servlet?

Answer Posted / chandra kunchala

yes ofcourse we should.
it is mandatory for servlet.
for servlets we required publc no argument constructor. if v
don't having that one, our servlet should not work, even
though if you are not crating the public no-argument
constructor, the java compiler will take the responsibility
to create public no- argument constructor.. mean while your
servlet should be public otherwise you will get
RuntimeException.


we can create costructor for sevelet but it should b no-
argument constructor. and u r servlet should be public.
and one more thing this constructor in not in the place of
init() method..

Is This Answer Correct ?    7 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is the different between a servlet and a cgi? Why do you go for servlet rather than cgi?

568


How can you start a jta transaction from a servlet deployed on jboss?

669


I have a requirement Here we have a ResultSet object that will contain 50 records i need to print those recors in to a webpage(i.e; view according to MVC architectures that mybe servlet or jsp) . Here i need to print the records 10 per page that is 1 to 10 in page one and 11 to 20 in page two like remaining will be appeared in other pages we need to display those page numbers whenever we click on that page number we will go to that page and display 10 records like we will display 5 pages it is like this << 1 2 3 4 5 next >>

2523


What are the uses of servlet

627


What is the effective way to make sure all the servlets are accessible only when user has a valid session?

561






What are the advantages of cookies?

624


How we can create war file in servlet?

653


What is the inter-servlet communication?

693


When a servlet accepts a call from a client, it receives two objects. What are they?

754


What are important features of Servlet 3?

586


How will two or three servlets interact or communicate with each other?

893


what is servlet chaining?

617


When servlet is loaded?

585


What are its drawbacks of cgi?

559


Can filter be used as request or response?

540