Java Reference
In-Depth Information
T ABLE 14.3
Continued
Implicit
Variable
Type
Description
Scope
Protocol-dependent
Represents the response
Page
response
subtype of either
object that triggered the
request
javax.servlet.
ServletResponse
or javax.servlet.
HttpServletResponse
Represents the
Session
session
javax.servlet.
session object, if any,
created for the client
during an HTTP request
http.HttpSession
JSP Scripting
JSP scripting is a mechanism for embedding code fragments directly into an HTML page.
Three scripting language elements are involved in JSP scripting. Each of these JSP scripting
elements has its appropriate location in the generated servlet. In this section we will look at
these elements and how together they will result in a complete servlet.
Declarations
JSP declarations are used to declare variables and methods in the scripting language used in a
JSP page. A JSP declaration should be a complete declarative statement.
JSP declarations are initialized when the JSP page is initialized. After the declarations have
been initialized, they are available to other declarations, expressions, and scriptlets. The syntax
for a JSP declaration is as follows:
<%! declaration %>
A sample variable declaration using this syntax is declared here:
<%! String name = new String(“BOB”); %>
A sample method declaration using the same syntax is declared as follows:
<%! public String getName() { return name; } %>
Search WWH ::




Custom Search