| |
This object contains page scope variables. In particular,
beans declared with the jsp:useBean page scope are stored in the
pageContext attribute.
<%
pageContext.attribute.a = 1;
pageContext.attribute.b = 2;
for (var name in pageContext.attribute)
out.writeln(name, ": ", pageContext.attribute[name]);
%>
|
|
Returns the JspWriter for this response. This is the same
as the JSP 'out' implicit variable. JspWriter has the same properties and
methods as output streams.
<%
pageContext.out.writeln("Hello, world");
%>
|
|
Returns the page's session.
Welcome back. You've visited
<%= pageContext.session.value++ %> times
|
|
Returns the page's application
object. Along with application variables, the application
object lets scripts dynamically include files and forward results.
You are visistor
<%= pageContext.servletContext.attribute++ %>
|
|
Returns the page's generated servlet.
Note: This is not
the JSP engine's servlet, but the servlet generated for the particular
JSP page.
<%@ page info='Special Servlet' %>
<%= pageContext.servlet.servletInfo %gt;
|
|
Returns the page's request
object. The request object contains information from the HTTP
request, such as form data and allows forwarding pages to pass along
attributes.
<%
var req = pageContext.servletRequest
for (var key in req.form)
out.writeln(key, ": ", req.form[key]);
%>
|
name: George Washington
honesty: mythical
|
|
Returns the page's response
object. The response object lets application set response
headers and status codes. In general, JSP applications will write to
the 'out' object instead of using the response object directly.
<%
var res = pageContext.servletResponse
res.header["Expires"] = new Date().toString()
%>
|
For error pages,
returns the thrown exception.
<%
response.setStatus(500);
out.writeln("Exception: ", pageContext.exception)
%>
|
Includes the dynamic contents of the page at href.
href is relative to the current page and its root is the
application root.
include is the proper way to include JSP generated contents in
the current page.
Includes the dynamic contents of the page at href.
href is relative to the current page and its root is the
application root.
forward cannot be called after data has returned to the
browser. Because of JSP's 8k buffer, most applications can
ignore this limitation.
Copyright © 1998-2002 Caucho Technology, Inc. All rights reserved.
Resin® is a registered trademark,
and HardCoretm and Quercustm are trademarks of Caucho Technology, Inc. | |
|