Java Reference
In-Depth Information
Fig. 10.3
Title change
illustrating use of a bound
property
constructor. Within the JSP, any bean that is to be used is identifi ed by an action tag
that specifi es
jsp
as the library and
useBean
as the action name. Recall from the last
chapter that an action tag shows the bean's library and action name, separated by a
colon. Thus, the tag commences as follows:
<jsp:useBean
If the bean tag has no body (as is commonly the case), the closing angle bracket
is preceded by a forward slash:
/>
The bean tag must also specify the following attributes:
id
(name for individual bean);
class
(specifying both package and class).
For example:
<jsp:useBean id="myAccount" class="bank.Account" />
In addition, there are three optional attributes:
scope
;
type;
beanName
.
Only
scope
is of any real interest to us. This attribute specifi es the access to/
availability of the bean and takes one of the following four values:
page
(actions and scriptlets on the same page—the default);
request
(all pages servicing the same user request);
session
(all requests during the same user session);
application
(all users of the application).
Search WWH ::
Custom Search