Using javabeans (jsp), Working with javabeans, Accessing javabean class files – Adobe Dreamweaver CS3 User Manual

Page 679

Advertising
background image

DREAMWEAVER CS3

User Guide

672

If the SQL statement contains page parameters, ensure that the Default Value column of the Parameters box contains
valid test values before clicking Test.

If the query was executed successfully, a table displays the recordset. Each row contains a record and each column
represents a field in that record.

Click OK to clear the CFC Query.

8

Click OK.

Using JavaBeans (JSP)

Working with JavaBeans

JavaBeans components are architectural elements of multitier JSP applications. JavaBeans are typically used as part
of a middle business-logic layer meant to separate the presentation logic from data-access logic. In these applications,
the JavaBeans, (also referred to as beans) not the JSP pages, contain the logic that directly accesses the database.

In Dreamweaver, JavaBeans components are treated as sources of dynamic content for JSP pages, and appear in the
Bindings panel. You can double-click JavaBeans in the Bindings panel to view their properties, and then drag the
properties to the page to create dynamic data references.

You can also define a JavaBeans collection (a set of JavaBeans) as a source of dynamic content. However,
Dreamweaver supports only repeating regions and dynamic bindings when using JavaBean collections.

Accessing JavaBean class files

Copies of the bean class (or of the ZIP or JAR file that contains the bean class) must reside in the following locations:

On the system running Dreamweaver, a copy of the bean class must reside in the Dreamweaver Configu-
ration/classes folder or in the system’s class path. (Dreamweaver uses this copy of the class at design time.)

On the system running the JSP application server, the bean class must reside in the application server’s class path.
(Your application server uses this copy of the class at runtime.) The application server’s class path varies from
application server to application server, but generally the class path is to a WEB-INF folder with a classes/bean
subfolder.

If Dreamweaver and the application server are both running on the same system, and the application server uses the
system class path (not an internal class path), a single copy of the JavaBeans class can reside on the computer in the
system class path. Both the application server and Dreamweaver use this copy of the class. Otherwise, copies of the
JavaBeans class must reside in two paths on the computer (as described above).

The folder structure must match the JavaBeans’ package. For example, if the JavaBeans’ package is called

com.ardvark.myBean

, you must store the package in /com/ardvark/ within the class path or in the Dreamweaver

Configuration/classes folder.

Define a JavaBean for a JSP page

1

Select Window > Bindings to display the Bindings panel.

2

Click the Plus (+) button, and select JavaBean from the pop-up menu.

3

In the JavaBean dialog box, enter the bean’s name.

4

Select the bean’s scope.

September 4, 2007

Advertising