Example & Tutorial understanding programming in easy ways.

Explain the life cycle methods of a Servlet.

Explain the life cycle methods of a Servlet.

The servlet life cycle is manged by servlet container. The javax.servlet.Servlet interface defines three methods which is known as life-cycle method.

public void init(ServletConfig config) throws ServletException
public void service( ServletRequest req, ServletResponse res) throws ServletException, IOException
public void destroy()

init() :-methods used to initialized resources used in servlet .
service():- method called always when other request come.
destroy():- method called only once and used to destroy resources  which goes for garbage collected and finalized.

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!