JSP implicit 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:
Implicit Object | Class |
---|---|
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 |
9 Implicit objects in JSP
- 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. - 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. - Response: It is used for modifying or dealing with the response which is being sent to the client(browser) after processing the request.
Read full article here » Response implicit object with examples. - 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. - 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. - 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. - 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.
Read full article here » pageContext implicit object with examples. - 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.
vinod says
all the examples and content written in this site are very helpful and easy to understand..thnx for creating this site