Jsp Implicit Objects

These objects are created by JSP Engine during translation phase (while translating JSP to Servlet). They are being created inside service method so we can directly use them within Scriptlet without initializing and declaring them. There are total 9 implicit objects available in JSP.

Implicit Objects and their corresponding classes:

out javax.servlet.jsp.JspWriter
request javax.servlet.http.HttpServletRequest
response javax.servlet.http.HttpServletResponse
session javax.servlet.http.HttpSession
application javax.servlet.ServletContext
exception javax.servlet.jsp.JspException
page java.lang.Object
pageContext javax.servlet.jsp.PageContext
config javax.servlet.ServletConfig
  1. Out: This is used for writing content to the client (browser). It has several methods which can be used for properly formatting output message to the browser and for dealing with the buffer.
    Read full article here » OUT implicit object with examples.
  2. Request: The main purpose of request implicit object is to get the data on a JSP page which has been entered by user on the previous JSP page. While dealing with login and signup forms in JSP we often prompts user to fill in those details, this object is then used to get those entered details on an another JSP page (action page) for validation and other purposes.
    Read full article here » Request implicit object with examples.
  3. Response: It is basically used for modfying or delaing with the response which is being sent to the client(browser) after processing the request.
    Read full article here » Response implicit object with examples.
  4. Session: It is most frequently used implicit object, which is used for storing the user’s data to make it available on other JSP pages till the user session is active.
    Read full article here » Session implicit object with examples.
  5. Application: This is used for getting application-wide initialization parameters and to maintain useful data across whole JSP application.
    Read full article here » Application implicit object with examples.
  6. Exception: Exception implicit object is used in exception handling for displaying the error messages. This object is only available to the JSP pages, which has isErrorPage set to true.
    Read full article here » Exception implicit object with examples.
  7. Page: Page implicit object is a reference to the current Servlet instance (Converted Servlet, generated during translation phase from a JSP page). We can simply use this in place of it. I’m not covering it in detail as it is rarely used and not a useful implicit object while building a JSP application.
  8. pageContext: It is used for accessing page, request, application and session attributes.
    Read full article here » pageContext implicit object with examples.
  9. Config: This is a Servlet configuration object and mainly used for accessing getting configuration information such as servlet context, servlet name, configuration parameters etc.
    Read full article here » Config implicit object with examples.

0 comments… add one

Leave a Comment