calendar.jspCalendar.
This object can be used and modified later in the page. In
particular, the next two elements access properties of the object and insert these values into
the response page as strings.
FIGURE 1 1
A JSP Page using Beans and Scripting
JSP Container
JSP Page
class= calendar.jspCalendar />
request
response
Day: <%=clock.getDayOfMonth() %>
Year: <%=clock.getYear() %>
An Example Using a Tag Library
FIGURE 1 2
is another example of a JSP page. This page uses custom actions to create the
server side object and then to produce the response data. In the example, a
taglib
directive
first makes available into this page a tag library for data base queries. The directive indicates
the tag library to use and provides a prefix to use locally in this page to name those actions.
Designing tag libraries is a delicate effort, analogous to that of designing a language; we are
making no special effort here to define tags that are useful for any but pedagogical purposes.
For the purposes of this example, we will assume that this fictitious tag library introduces
four actions :
A
queryBlock
action introduces a data base connection; it can contain queryStatement
actions and queryCreateRow actions. The connData attribute refers to connection specific
data, like login and password, that are to be defined elsewhere; see Appendix 5.8.3 for
suggestions on where to place the information.
A
queryStatement
action must be enclosed in a queryBlock. A queryStatement's body is a
SQL statement; it will use the connection data defined in the enclosing queryBlock.
Chapter 1
Overview
20
JSP Web Hosting JavaServer Pages Specifications JSP Hosting
|
|
|
|
TotalRoute.net Business web hosting division of Vision Web Hosting Inc. All rights reserved. |