Prentice Hall and Sun Microsystems. Personal use only; do not redistribute.
236
Chapter 10 JSP Scripting Elements
Table 10.1 Attributes That Permit JSP Expressions
Element Name
Attribute Name(s)
jsp:setProperty
name
(see Section 13.3, Setting Bean Properties )
value
jsp:include
page
(see Chapter 12, Including Files and Applets in JSP
Documents )
jsp:forward
page
(see Chapter 15, Integrating Servlets and JSP )
jsp:param
value
(see Chapter 12, Including Files and Applets in JSP
Documents )
Example
Listing 10.1 gives an example JSP page; Figure 10 1 shows the result. Notice
that I included
META
tags and a style sheet link in the
HEAD
section of the
HTML page. It is good practice to include these elements, but there are two
reasons why they are often omitted from pages generated by normal servlets.
First, with servlets, it is tedious to generate the required
println
statements.
With JSP, however, the format is simpler and you can make use of the code
reuse options in your usual HTML building tool. Second, servlets cannot use
the simplest form of relative URLs (ones that refer to files in the same direc
tory as the current page) since the servlet directories are not mapped to
URLs in the same manner as are URLs for normal Web pages. JSP pages, on
the other hand, are installed in the normal Web page hierarchy on the server,
and relative URLs are resolved properly. Thus, style sheets and JSP pages can
be kept together in the same directory. The source code for the style sheet,
like all code shown or referenced in the book, can be downloaded from
http://www.coreservlets.com/
.
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