Composing the JSPs Using JavaBeans
Now that you have created and tested the MonthBean and CalendarRequest JavaBeans, you will need to integrate them into the JSPs using simple JSP useBean tags.
The syntax for the useBean tag is
<jsp:useBean id="beanInstanceName" scope="page|request|session|application" { class=" package.class " [ type="package.class" ] | type="package.class"| beanName="{ package.class | <%= expression %>}" type="package.class "} { /> | other elements </jsp:useBean> }
The tag translates into a field in a Java class as
package.class beanInstanceName = null;
The scope defines the lifetime of the bean instance or object reference. The different scope attributes are described in Table 4.5.
Get Java Server Pages from scratch now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.