JSP Predefined Variables
JSP pages can use several predefined variables that are outside the scope of the JSTL, so a brief introduction is in order. The list of variables also provides a good overview of the objects that can be accessed and manipulated by a JSP page.
application: application provides access to variables stored in a ServletContext object. Variables that are stored in the ServletContext object can be shared between servlets that are part of the same application.
config : config represents a ServletConfig object for a JSP page. ServletConfig objects contain initialization parameters via a jspInit method. Initialization parameters are parameters that are passed from a JSP server instance to a JSP page at page initialization. Initialization parameters are defined in the WEB-INF/web.xml page for a JSP server instance.
out : out is a buffered PrintWriter called JspWriter. JSP page buffering is controlled by setting a buffer size attribute using a JSP page directive.
Buffering is enabled by default, and the default page buffer is 8kb. Out is not needed for JSP expressions, because they are automatically sent to the JspWriter. Scriptlets (Java Code embedded on a JSP page) and other objects can explicitly refer to the out variable to pass output to the JspWriter.
page : page provides a placeholder for a page object. Intended for use with non-scripting languages, so not commonly used with standard JSP pages.
pageContext : pageContext contains JSP page-specific objects and functionality, such as JspWriter. pageContext provides access to all page-related classes in this table through a single interface.
request : request represents a JSP page request. It provides access to parameters, HTTP header information, cookies, and initialization parameters.
response : response represents the HTTP response to a JSP page request. HTTP status codes and header information can be manipulated using response, unless buffering has been disabled. JSP page buffering is controlled by setting a buffer size attribute using a JSP page directive. Buffering is enabled by default, and the default page buffer is 8kb.
session : session represents an HTTP session object associated with a JSP page request. Sessions are enabled by default on JSP pages. JSP sessions can be disabled by using a JSP page directive to set session=”false”.