
Implicit Objects in JSP
In this video we will see : - What is implicit object - Implicit objects of JSP - Example of implicit object in JSP Built-In Object (can be used in Scriptlet and Expression) request (HttServletRequest) response (HttpServletResponse) pageContext (PageContext) out (JspWriter) ~ PrintWriter object session (HttpSession) application (ServletContext) config (ServletConfig) - pageContext :- can set the value or can get the value Default scope of pageContext is its current page We can also change its scope. Editing Monitors : https://amzn.to/2RfKWgL https://amzn.to/2Q665JW https://amzn.to/2OUP21a. Check out our website: http://www.telusko.com Follow Telusko on Twitter: https://twitter.com/navinreddy20 Follow on Facebook: Telusko : https://www.facebook.com/teluskolearn... Navin Reddy : https://www.facebook.com/navintelusko Follow Navin Reddy on Instagram: https://www.instagram.com/navinreddy20 Subscribe to our other channel: Navin Reddy : https://www.youtube.com/channel/UCxmk... Telusko Hindi : https://www.youtube.com/channel/UCitz... Donation: PayPal Id : navinreddy20 Patreon : navinreddy20 http://www.telusko.com/contactus
Implicit Objects in JSP
Implicit Objects in JSP
Introduction to Implicit Objects
- The speaker introduces the topic of implicit objects in JSP, contrasting it with servlets where developers must explicitly create request and response objects.
- In servlets, developers are responsible for creating references to various objects like request, response, and session.
Overview of JSP Implicit Objects
- JSP simplifies development by providing seven implicit objects: request, response, page context, session, application (similar to servlet context), and config.
- These implicit objects do not require instantiation; they are readily available for use within JSP pages.
Utilizing Request and Page Context
- The speaker explains how to access parameters using the request object without needing explicit declaration in JSP.
- Page context is introduced as a new feature in JSP that allows setting and getting attributes specific to the current page.
Scope of Attributes
- Attributes set via page context have a scope limited to the current page. This contrasts with session scope (accessible across multiple pages during a user session).
- The speaker elaborates on different scopes:
- Session Scope: Accessible throughout the user's session.
- Request Scope: Available only during the current request/response cycle.
- Page Context: Limited strictly to the current page.
Setting Values Across Scopes
- Developers can specify attribute scopes when using page context. For example, attributes can be set for both page and session scopes using constants like
sessionScope
.
- A recap of available scopes is provided: request, session, application (servlet context), and page context.
Accessing Config Object in JSP
- Unlike servlets where configuration requires instantiation (
config = getServletConfig()
), JSP allows direct access to config methods throughconfig
without prior setup.
- The ease of accessing these implicit objects is emphasized as a significant advantage of using JSP over servlets.