Which method the Servlet container call to create the
instance of the servlet?
Answers were Sorted based on User's Feedback
Answer / ravikiran(aptech mumbai)
After The successfull parsing of web.xml container will find
the particular class name which is mapped in web.xml and calls
class.forName(classname).newInstance() method.Then calls
init(ServletConfig config) of GenericServlet for
initializing the instance of the servlet.
| Is This Answer Correct ? | 35 Yes | 1 No |
Answer / m.gangadhar from sathya techno
The ServletContainer is used default zero argument
constructor to create servlet instance then after it calls
init(ServletConfig cg) it internally calls init()for
initialization puposes.
Plz guys init() is not used for creation of servlet instance
| Is This Answer Correct ? | 26 Yes | 2 No |
Answer / naveen kumar bandi
to create an instance of servlet servlet container calls
newInstance() method
| Is This Answer Correct ? | 20 Yes | 3 No |
Answer / priyanjan
Servlet container invokes the init() method to create the
instance of servlet.
| Is This Answer Correct ? | 18 Yes | 11 No |
init() method is only used to initialize a servlet, and it
is called after the servlet instance has been created.
| Is This Answer Correct ? | 12 Yes | 5 No |
Answer / samik bandyopadhyay
The init() method is only used to initialize an existing
servlet instance before it starts providing service to
requests, it's never used for creating a servlet instance.
I'm searching for the method which creates the servlet
instace. But I can assure that we can't create a servlet
instace, it's done by the container.
| Is This Answer Correct ? | 8 Yes | 4 No |
Answer / kishore
servlet container calls the init() method to create servlet
instance
| Is This Answer Correct ? | 13 Yes | 10 No |
Answer / priyanjan
servlet container creates the init() method
| Is This Answer Correct ? | 17 Yes | 15 No |
servlet container calls the Class.instanceOf() method
to create a instance of servlet.
| Is This Answer Correct ? | 3 Yes | 1 No |
what is the difference between ServletContext and ServletConfig
What is difference between ServletResponse sendRedirect() and RequestDispatcher forward() method?
How to read request headers from servlets?
What is a java servlet?
give the syntax of doGet() and doPost()?
Explain load on start-up and its importance?
What is Servlet Context?
What are the features added in Servlet 2.5?
What are different ways for authentication of servlet?
Explain url encoding?
Hello, My project requirement is like I need to create a web page using MVC pattern. I hava a bean class, jsp page, servlet, service and dao. My jsp has two fields. One is dropdown list. The option values has to get populated from the database table. The other one is a text box and its value has to come from database table. As of now I have defined the fields in bean class, got the values from database using arraylists in dao class and I called this from service class. Can anyone please tell me the workflow of how the servlet will get this arraylist and populate the arraylist values as dropdown options in jsp page? Also I would like to know the role of bean class in MVC pattern? Thanks in advance!
What is a Proxy Server?