File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Basic reason Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Basic reason" Watch "Basic reason" New topic

Basic reason

Somasundaram Karthikeyan

Joined: Feb 28, 2001
Posts: 7
In JSP, there are three fuctions init,destroy and service
The first two init(), destroy() methods can be handled by the page authors. But not the last one service() method why?
Thanks in advance.
lokesh reddy
Ranch Hand

Joined: Sep 15, 2000
Posts: 66
Hi Somasundaram,
The three functions which u were talking about are known as life cycle methods of jsp page.
You use the jspInit method to initialize any variables, and you use the jspDestroy method to free the resources ur jsp using. The service method is important and it is automatically generated by the jspcompiler. The service method contains all the translated code (The html,Scriptles,Directives e.t.c). So if u try to overwrite it, then ur program will not behave like what ur expecting from it.
I think u find this info useful.
Somasundaram Karthikeyan

Joined: Feb 28, 2001
Posts: 7
Hi Lokash Reddy,
Thanking u for the kind explanation for my question.
I agree. Here's the link:
subject: Basic reason
jQuery in Action, 3rd edition