Prentice Hall and Sun Microsystems. Personal use only; do not redistribute.
534
Appendix A
Servlet and JSP Quick Reference
response: the
HttpServletResponse
associated with response to
client.
out: the
JspWriter
(
PrintWriter
subclass) used to send output to the
client.
session: the
HttpSession
object associated with request. See Chapter
9.
application: the
ServletContext
as obtained by
getServletConfig().getContext()
. Shared by all servlets and JSP
pages on server or in Web application. See Section 15.1.
config: the
ServletConfig
object for this page.
pageContext: the
PageContext
object associated with current page.
See Section 13.4 for a discussion of its use.
page: synonym for
this
(current servlet instance); not very useful now.
Placeholder for future.
A.11 The JSP page Directive: Structuring
Generated Servlets
The import Attribute
<%@ page import="package.class" %>
<%@ page import="package.class1,...,package.classN" %>
The contentType Attribute
<%@ page contentType="MIME Type" %>
<%@ page contentType="MIME Type; charset=Character Set" %>
Cannot be invoked conditionally. Use
<% response.setContentType("..."); %>
for that.
Example of Using contentType
Excel.jsp
<%@ page contentType="application/vnd.ms excel" %>
<% Note that there are tabs, not spaces, between columns. %>
1997
1998
1999
2000
2001 (Anticipated)
12.3
13.4
14.5
15.6
16.7
Second edition of this book: www.coreservlets.com; Sequel: www.moreservlets.com.
Servlet and JSP training courses by book's author: courses.coreservlets.com.
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved