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
class= calendar.jspCalendar />
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
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 :
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.
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.