Introduction to implicit objects:
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 | avax.servlet.jsp.PageContext |
config | javax.servlet.ServletConfig |
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.
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.
Response: It is basically used for modfying or delaing with the response
which is being sent to the client(browser) after processing the request.
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.
Application: This is used for getting application-wide initialization
parameters and to maintain useful data across whole JSP application.
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.
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.
pageContext: It is used for accessing page, request, application and
session attributes.
Config: This is a Servlet configuration object and mainly used for
accessing getting configuration information such as servlet context, servlet
name, configuration parameters etc.