Monday, May 24, 2010

latest jsp interview question

jsp - API package : javax.servlet.jsp
-------------------------------------
a. interface
1. HttpJspPage
It's extend JspPage. It have one method _jspService(req,res)
2. JspPage
It's extend javax.servlet.Servlet
It have two method jspDestroy(),jspInit()

b. Classes
1. ErrorData
2. Jsp Context
3. JpsEngineInfo
4. JspFactory
5. JspWrite
6. PageContext
c. Exception
JspException
JspTagException
SkipPageExceptiom
----------------------------------------------------------------------------------------------

JSP Life Cycle

If an instance of the JSP page's servlet does not exist, the container:

    1. Loads the JSP page's servlet class
    2. Instantiates an instance of the servlet class
    3. Initializes the servlet instance by calling the jspInit method
  1. Invokes the _jspService method, passing a request and response object. Don't Overridden.

3. If the container needs to remove the JSP page's servlet, it calls thejspDestroy method.



Question: What are implicit Objects available to the JSP Page?

Answer: Implicit objects are the objects available to the JSP page. These objects are created by Web container and contain information related to a particular request, page, or
application.
The JSP implicit objects are:



Variable
Class
Description
application
javax.servlet.ServletContext
The context for the JSP page's servlet and any Web components contained in the same application.
config
javax.servlet.ServletConfig
Initialization information for the JSP page's servlet.
exception
java.lang.Throwable
Accessible only from an error page.
out
javax.servlet.jsp.JspWriter
The output stream.
page
java.lang.Object
The instance of the JSP page's servlet processing the current request. Not typically used by JSP page authors.
pageContext
javax.servlet.jsp.PageContext
The context for the JSP page. Provides a single API to manage the various scoped attributes.
request
Subtype of javax.servlet.ServletRequest
The request triggering the execution of the JSP page.
response
Subtype of javax.servlet.ServletResponse
The response to be returned to the client. Not typically used by JSP page authors.
session
javax.servlet.http.HttpSession
The session object for the client.

No comments:

Post a Comment