Thread: What JSP lifecycle methods can

Forum : Java Server Pages (Jsp)   21-4-2017 06:09:19 AM
User Image
Sriman

Member

Joined: Jul 15, 2016

Points: 560

Threads: 641

Posts: 174

What JSP lifecycle methods can

| Quote Date : Apr 21, 2017    Views:863    

What JSP lifecycle methods can I override?

tags: jsp j2ee

Comments

User Image
javaMad

Newbie

Joined : Mar 12, 2018

Points : 100

Threads: 0

Posts: 13

Re: What JSP lifecycle methods can

Reply Date : Apr 22, 2018

We cannot override the _jspService() method within a JSP page. We can override the jspInit() and jspDestroy() methods within a JSP page. jspInit() can be useful for allocating resources like database connections, network connections. It is good programming practice to free any allocated resources within jspDestroy().
The jspInit() and jspDestroy() methods are each executed just once during the lifecycle of a JSP page .

But these jspInit() and jspDestroy() are
convience method not the lifecycle method. _jspInit() and _jspDestroy() are called life cycle methods.these methods are already available in the JSP page like _jspService(). To write the allocating resources like database connections and free any allocated resources they provide alternative methods like jspInit() and jspDestroy() .

User Image
chowdaka5

Newbie

Joined : Jun 28, 2017

Points : 145

Threads: 29

Posts: 98

Re: What JSP lifecycle methods can

Reply Date : Jul 3, 2017

We cannot override the _jspService() method within a JSP page. We can override the jspInit() and jspDestroy() methods within a JSP page. jspInit() can be useful for allocating resources like database connections, network connections. It is good programming practice to free any allocated resources within jspDestroy().
The jspInit() and jspDestroy() methods are each executed just once during the lifecycle of a JSP page .

Load More

No More Comments