Head First Book:Please refer diagram on page no 307 .
Step 5: The continer inistantiates the servlet and causes the servlet's jspInit() method to run.
In diagram the container is calling jspInit() on myJSP_jsp and then this object becomes servet ie(myJSP_jsp) which then ready to handle the client request.
Q1)I am confused,I think the container must call _jspInit().Because if we see the generated source code there is no jspInit().
Q2)On page no:305 it is written that jspInit():This method is called from init().If we compared this statement with diagram in step no5
servlet is getting generated after calling jspInit().So how can init() can call jspInit()?
Q1) JSPs must implement the HttpJspPage interface, which extends the JspPage interface, which defines jspInit and jspDestroy methods. The container must call jspInit(). What you are looking at is a container generated class implementing HttpJspPage. If you are using Tomcat, the class is org.apache.jasper.runtime.HttpJspBase, which implements HttpJspPage.
Q2) The servlet is not generated after calling jspInit. It is generated during the translation phase. There, your JSP becomes a servlet. The first time it is instanciated, its init() method will be called, which in turn will call the jspInit() method.