Example & Tutorial understanding programming in easy ways.

The life cycle of a servlet?

The life cycle of a servlet

The life cycle of a servlet is controlled by the servlet container. We can't controlled servlet life cycle

When very first request comes then servlet container load and initialized serlvlet class and create object of Servletconfig and pass in into init method and servlet container  called init() methods.After that servlet container create Object of ServletRequest and ServletResponse and pass in into service() methods. init() methods called only once in life .
If other request comes then container creates Object of ServletRequest and ServletResponse and pass in into service() methods for this.
destroy() method called only when server restart(or servlet container) or shut down or no longer required for servicing any request, the servlet container will  calls the destroy() method .

Read More →
Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!