Overview of JSP Syntax Element
 
JSP Objects
 
The term JSP object refers to a Java class instance declared within or accessible to a JSP page.
 
JSP objects can be either:
.explicit--
Explicit objects are declared and created within the code of our JSP page, accessible to that page and other pages according to the scope setting us choose.
or
. implicit--
Implicit objects are created by the underlying JSP mechanism and accessible to Java scriptlets or expressions in JSP pages according to the inherent scope setting of the particular object type.
 
 
Explicit Objects
Explicit objects are typically JavaBean instances that are declared and created in jsp:useBean action statements.
example:
<jsp:useBean id="pageBean" class="mybeans.NameBean" scope="page" />
This statement defines an instance, pageBean, of the NameBean class that is in the mybeans package.
 
 
Implicit Objects
JSP technology makes available to any JSP page a set of implicit objects. These are Java objects that are created automatically by the JSP container and that allow interaction with the underlying servlet environment.
 
The following implicit objects are available:
. page
This is an instance of the JSP page implementation class and is created when the page is translated. The page implementation class implements the interface javax.servlet.jsp.HttpJspPage. Note that page is synonymous with this within a JSP page.
 
. request
This represents an HTTP request and is an instance of a class that implements the javax.servlet.http.HttpServletRequest interface, which extends the javax.servlet.ServletRequest interface.
 
. response
This represents an HTTP response and is an instance of a class that implements the javax.servlet.http.HttpServletResponse interface, which extends the javax.servlet.ServletResponse interface.
The response and request objects for a particular request are associated with each other.
 
. pageContext
This represents the page context of a JSP page, which is provided for storage and access of all page scope objects of a JSP page instance. A pageContext object is an instance of the javax.servlet.jsp.PageContext class.
The pageContext object has page scope, making it accessible only to the JSP page instance with which it is associated.
 
. session
This represents an HTTP session and is an instance of a class that implements the javax.servlet.http.HttpSession class.
 
. application
This represents the servlet context for the Web application and is an instance of the javax.servlet.ServletContext class.
The application object is accessible from any JSP page instance running as part of any instance of the application within a single JVM. (The programmer should be aware of the server architecture regarding use of JVMs.)
 
. out
This is an object that is used to write content to the output stream of a JSP page instance. It is an instance of the javax.servlet.jsp.JspWriter class, which extends the java.io.Writer class.
The out object is associated with the response object for a particular request.
 
. config
This represents the servlet configuration for a JSP page and is an instance of a class that implements the javax.servlet.ServletConfig interface. Generally speaking, servlet containers use ServletConfig instances to provide information to servlets during initialization. Part of this information is the appropriate ServletContext instance.
 
. exception
This implicit object applies only to JSP error pages--these are pages to which processing is forwarded when an exception is thrown from another JSP page. They must have the page directive isErrorPage attribute set to true.
The implicit exception object is a java.lang.Exception instance that represents the uncaught exception that was thrown from another JSP page and that resulted in the current error page being invoked. The exception object is accessible only from the JSP error page instance to which processing was forwarded when the exception was encountered.