Hi guys.. Well can u tell me that why there is need of
"init()" , i mean why can not we initialize the servlet object
with the help of constructors?
Thank you.

Answer Posted / abhijit mishra

As per Servlet specification, the servlet container is
responsible for creating the servlet and initializing it( or
making it ready for client to request it).

So according to the Client:servlet container contract, the
servlet creation and inialization is done by the container
which will differ for different container provider.

So u can't use constructors to create servlets.

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

A client sends requests to two different web components. Both of the components access the session. Will they end up using the same session object or different session ?

698


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

658


Explains the differences between context.getrequestdispatcher() and request.getrequestdispatcher()?

627


What is session?

711


In the servlets, we are having a web page that is invoking servlets ,username and password? which is checks in database? Suppose the second page also if we want to verify

665






Explain url encoding in servlet?

674


What must be implemented by all servlets?

662


Explain the steps involved in placing a servlet within a package?

647


What are some disadvantages of storing session state in cookies?

671


What methodology can be followed to store more number of objects in a remote server?

1902


Write the code to get the server information in servlet.

662


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

675


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 >>

2616


What are the steps involved in placing a servlet within a package?

668


What is servlet and list its types?

623