Saturday, November 27, 2010

Jsp Basics

Note 1 : _JspInit() , _jspService(), _jspDestroy()  are called the life cycle methods of the JSP.
Note 2 : _jspInit() & _jspDestroy() can override ..


Four phases in jsp life cycle ;
1) translation : tranforming the jsp into  java file( this is translation) and servlet class file (compilation).
2) Initialization :  loads class file and creates the instance of servlet done by jsp engine.


duties by web container :
3) Execution : execute the client request by calling the servlet method '_jspService()'
4) Finilazation : calling the _jspDestroy() to free the resources acquired by the servlet.


What is the advantage of JSP?
Ans : 1) Write HTML
          2) Read and maintain the HTML.


Note: JSP runs entirely on ServerSide.


Question : When does the page Translation occurs?
Ans: 1) Typically at each instance the jsp got modified.
         2)  Never done for each request.




What is Web Container ?
Ans : It is a part of web server contains servlet engine and jsp engine responsible
 for executing the servlets and jsp's.


Note : webserver does not support for the EJB.
Note : Application server supports all the three servlets , JSP's and EJB's.


Example , webserver : Tomcat  & JRunner.
Example : Application server : weblogic , JBoss.


http://geekexplains.blogspot.com/2008/06/whats-jsp-life-cycle-of-jsp-javaserver.html

Question : Explain the hirerachy of JSP servlets.


Ans: The Servlet Class which is generated from the JSP page. 


                    Servlet -- Interface -- javax.servlet Package
                        |
                    JSP Page -- Interface
                       |
                HTTPJspPage -- Interface-- Javax.servlet.jsp package
                      |
                 Generated Servlet class from the JSP...


The JSPPage Inteface has two methods which must be Implemented by all classes
those are 1 ) jspInit() 2) jspDestroy()   
HTTPJspPage-- This Interface declares method _jspService().


                       

No comments:

AWS certification question

AWS AWS Hi! this is for questions related to AWS questions. EC2 instances EC2 storage types cold HDD : 1. Defines performance in terms...