ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

Explain servlet lifecycle phases?

user-image
تم إضافة السؤال من قبل مستخدم محذوف‎
تاريخ النشر: 2014/01/20
Nisha A
من قبل Nisha A

The Init() method- The init method is designed to be called only once

publicvoid init()throwsServletException{// Initialization code...}

 

The  service() method - The service() method is the main method to perform the actual task

publicvoid service(ServletRequest request,ServletResponse response)throwsServletException,IOException{}

 

The doGet() method-A GET request results from a normal request for a URL or from an HTML form that has no METHOD specified and it should be handled by doGet() method.

 

publicvoid doGet(HttpServletRequest request,HttpServletResponse response)throwsServletException,IOException{// Servlet code}

The doPost() method - A POST request results from an HTML form that specifically lists POST as the METHOD and it should be handled by doPost() method.

publicvoid doPost(HttpServletRequest request,HttpServletResponse response)throwsServletException,IOException{// Servlet code}

 

The destroy() method - The destroy() method is called only once at the end of the life cycle of a servlet.

publicvoid destroy(){// Finalization code...}

المزيد من الأسئلة المماثلة