Life of the the jsp page is just same as the servlet life cycle. After get translated the jsp file is just like a servlet. The life cycle of the jsp page is given below:
The code of the program is given below:
| <html> <head> <title>The lifecycle of jsp page</title> </head> <body> <h1>Showing the life cycle of jsp using jspInit and jspDestroy</h1> <%! int num; int count; public void jspInit() { count++; num = 10; } public void jspDestroy() { count--; num = 0; } %> <% out.println("The number is " + num + "<br>"); out.println("The counter is " + count + "<br>"); %> </body> </html> |
The output of the program is given below:

|
Recommend the tutorial |
Ask Questions? Discuss: Life Cycle of a Jsp Page View All Comments
Post your Comment