JSPs provide you with a set of implicit objects that you can use to build your applications. These objects do not have to declared or initialized . Table 14-1 describes nine implicit objects/ variables .
Object Name | Description |
---|---|
application | Provides access to the application's environment. |
config | Provides access to the servlet configuration for JSPs. |
exception | Only available if a JSP is marked as a JSP error page. This is covered in more detail in the Error Pages section of this chapter. |
Out | Provides access to the JSP's output stream. |
page | Provides access to the JSP's implementation object that is created when the page is translated. |
pageContext | Provides access to attributes stored in the page scope. |
request | Provides access to attributes and parameters stored in the request scope. |
response | Provides access to the response object. |
session | Provides access to attributes stored in the session scope. |
Implicit objects can be used in scriptlets to access or update values and access methods provided by the classes that they represent. The following example shows how to use the request and session implicit objects.
<% session.setAttribute("username", request.getParameter("username")); %>