Adding a JSP useBean Tag to Initialize the DataHandler Class

A jsp:useBean tag identifies and initializes the class that holds the methods that run in the page. To add a jsp:useBean tag, follow these steps:

  1. Open employees.jsp in the Visual Editor.
  2. In the Component Palette, select the JSP set of components. Scroll through the list and drag and drop UseBean to your page. The Insert UseBean dialog box is displayed.
  3. In the Insert UseBean dialog box, enter empsbean as the ID. For the Class, click Browse.... The Class Browser dialog box is displayed. Type hr.DataHandler in the Match Class Name text box. Click OK. Leave the Type and BeanName fields blank and set the Scope to session.
  4. Click OK to create the tag in the page.

Figure 4-7 shows the representation of the useBean tag in the employees.jsp page.

Figure 4-7 useBean Representation in the employees.jsp File

Description of Figure 4-7 follows
Description of "Figure 4-7 useBean Representation in the employees.jsp File"

If you do not see the UseBean tag on the design view of the JSP, then go to Preferences from the Tools menu, and select the Show Invisible JSP Elements option, which is shown Figure 4-8.

Figure 4-8 Preferences Window to Select JSP and HTML Visual Editor Options

Description of Figure 4-8 follows
Description of "Figure 4-8 Preferences Window to Select JSP and HTML Visual Editor Options"