The Container generates a class from your JSP that implements the HttpJspPage interface. This is the only part of the generated servlet’s API that you need to know. You don’t care that in Tomcat, for example, your generated servlet extends:
All you need to know about are the three key methods:
This method is called from the init() method. You can override this method. (Can you figure out how?)
This method is called from the servlet’s destroy() method. You can override this method as well.
This method is called from the servlet’s service() method, which means it runs in a separate thread for each request. The Container passes the Request and Response objects to this method.
You can’t override this method! You can’t do ANYTHING with this method yourself (except write code that goes inside it), and it’s up to the Container vendor to take your JSP code and fashion the _jspService() method that uses it.
Note the underscore at the front of the _jspService() method
It’s NOT in front of the other two methods, jspInit() and jspDestroy(). Think of it this way, the underscore in front of the method means “don’t touch!”
So, no underscore in front of the name means you can override. But if there IS an underscore in front of the method name, you must NOT try to override it!