Implicit Objects tutorial in JSP
Implicit objects are Java objects in JSP which will be created by the servlet container. usually, if we want to access any data in a class, we have to create an object using a new operator and then access the methods on that object. for implicit objects, we can use them directly on JSP pages.
JSP is used in MVC model architecture soi will separate presentation logic with model logic. JSP is used as presentation logic which we can use the objects without creating the instances.
In servlets API, we have to create the objects, call the methods on the objects. but to use the servlet-specific information in JSP, implicit objects can be used without creating an object.
This post is part of j2ee tutorials in my blog.
1.request 2.response 3.page,session,application 4.pageContext 5.config 6.exception 7.out
request implicit Objects
request scope is similar to the HttpServletRequest object which holds request-specific information. request object in JSP is equal to HttpServlet in servlets. the quest object is used to persist the request scope parameters and request meta header information like
response implicit Objects
the response is similar to the HttpServletResponse object in a servlet. Response object holds the information returned to the client. This object holds cookies, content and type, and HTTP header
Page implicit Objects
the page indicates current JSP page and has the scope of JSP page execution
Session implicit Objects
The session object is HttpSession class in Servlets. Session holds personalized data of a user. In a real scenario, Session object is created one for each user
application implicit Objects:- application is a global object similar to in Servlets. application objects hold information about web applications and only one application for each web application
PageContext implicit Objects
jsp pageContext is object of PageContext in servlets.
Config implicit Objects
JSP config is an instance of the ServletConfig class. which holds configuration parameters at the servlet level.
Web applications can have Config objects in such a way that each servlet has only one config object.
Exception implicit Objects
The exception object is an instance of the Throwable class.