Implicit JSP Objects
When you use scripting elements in a JSP page, you always have access to a number of objects (listed in Table 6.1) that the JSP container makes available. These are called implicit objects. These objects are instances of classes defined by the servlet and JSP specifications. Appendix B, contains complete descriptions of all methods for each class, and we will cover them in more detail as we move through the book. However, I want to briefly introduce them here, as they are used in a number of examples throughout this book.
Table 6-1. Implicit JSP Objects
|
Variable Name |
Java Type |
|---|---|
request |
javax.servlet.http.HttpServletRequest |
response |
javax.servlet.http.HttpServletResponse |
pageContext |
javax.servlet.jsp.PageContext |
session |
javax.servlet.http.HttpSession |
application |
javax.servlet.ServletContext |
out |
javax.servlet.jsp.JspWriter |
config |
javax.servlet.ServletConfig |
page |
java.lang.Object |
exception |
java.lang.Throwable |
Here is some more information about each of these implicit objects:
-
request The
requestobject is an instance of the class namedjavax.servlet.http.HttpServletRequest. This object provides methods that let you access all the information that’s available about the current request, such as request parameters, attributes, headers, and cookies. We use therequestobject in a couple of examples later in this chapter.-
response The
responseobject represents the current response message. It’s an instance of thejavax.servlet.http.HttpServletResponse ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access