About Web Beans

JDeveloper provides predefined web-enabled JavaBeans, called web beans, for use in JSP pages. Web beans in JDeveloper are all visual components that the JSP developer can use to output HTML directly from the bean. Web beans have access to the HttpRequest and HttpResponse objects of the JSP page and are used to generate content dynamically. Because web beans are reusable objects, they simplify the development of JSP pages where a consistent look and feel is desired. You can:

Among the web beans that you can use to design JSP pages, there are two distinct look and feels offered:

All web beans implement, either directly or indirectly, JDeveloper's WebBean interface. Web beans (both standard web beans and JS web beans) fall into two groups:

About JavaScript-enabled Web Beans

There are several reasons to use the JavaScript (JS) web beans:

The JS web beans rely on JavaScript, as supported by Microsoft Internet Explorer and Netscape Navigator browsers, to generate much of the HTML needed to create the JSP forms. This can reduce the size of pages to download, requiring only descriptive arguments and data to be loaded, while the UI elements get generated on the client.

About Data Web Beans

Data web beans provide access to datasources represented by a view object defined in a Business Components project. The data web beans don't implement the DataWebBean interface directly; they instead extend the class DataWebBeanImpl, which provides implementations of both the WebBean interface and the DataWebBean interface. The data web beans implementation makes it easy to create reusable JSP page elements that can access data encapsulated in business components.

For example, you can use data web beans to:

The data web beans include:

Standard Web Beans

JS Web Beans

NavigatorBar

JSNavigatorBar

RowSetBrowser

JSRowSetBrowser

EditCurrentRecord

same as standard web bean

ViewCurrentRecord

JSViewCurrentRecord

FindForm

same as standard web bean

XMLDataGenerator

not available

RowSet Navigator

same as standard web bean

Chart

not available

not available

JSTreeBrowser

About Database Transactions in Data Web Bean Based Applications

When the web application user modifies data through databound web beans and clicks Submit in the JSP page to process the data, the web application framework (basically Business Components for Java) handles the database transaction differently depending on the state of the application module when it is released:

Release Mode

Database Transactions and User Actions when the Application Module is Released

Stateless

The web application framework automatically posts and commits any changes because the application module state is not maintained between requests in stateless mode. The user is not expected to initiate the commit in stateless mode: the Commit and Rollback buttons are disabled in the JSP page.

Stateful

The web application framework merely saves the application module state, including the data changes, to the database at the end of a page request. In this mode, the user is expected to initiate the commit by clicking the Commit button in the process JSP page. Once the user clicks the Commit button, the framework will immediately initiate a post and commit (together, as one step) on the database. Optionally, the user can click the Rollback button to prevent their changes from entering the database without ever initiating a post. Because the application module state is preserved, the user can initiate the Commit or Rollback at any point during the HTTP session.

Reserved

The web application framework automatically posts any changes to the database (and initiates DML-specified database triggers on the effected tables). In this mode, the user is expected to click either the Commit button or Rollback button in the process JSP page. Because the application module itself is not released for the duration of the HTTP session, the user can initiate the Commit or Rollback at any point.

About HTML Web Beans

The HTML or non-data bound web beans:

For example, the toolbar web bean generates an HTML toolbar just as its parent HTMLToolbar does but, unlike its parent, stores references to some of the JSP's implicit objects within its member variables. A JSP page's implicit objects are accessible to JSP elements such as Java scriptlets.

The HTML web beans include:

Standard Web Beans

JS Web Beans

Toolbar

JSToolbar

TableControl

JSTableControl

EditForm

N/A

N/A

JSTreeControl

N/A

JSButtonControl

N/A

JSButtonBarControl

N/A

JSContainer

N/A

JSTabContainer

About the Derivation of Web Bean Classes

A knowledge of JDeveloper's web bean classes is important to understand how to use JDeveloper's predefined web beans and how to create your own web beans.

The following diagram shows the relationships of the predefined web bean classes (the shaded boxes) to the classes they extend and the interfaces they implement.

Web Bean Inheritance Diagram

The predefined non-JavaScript web beans inherit from:


Interface Name: WebBean

Package: oracle.jdeveloper.html

Source: [bc4jhtmlsrc.zip]\jdeveloper\html\WebBean.java

Description:

Defines the base methods for a web bean. Implement this interface when you define a web bean that doesn't access a data source and that must extend another class. The predefined web beans Toolbar, TableControl, and EditForm implement this interface, because they must extend the classes HTMLToolbar, HTMLTable, and HTMLForm respectively.


Class Name: WebBeanImpl

Package: oracle.jdeveloper.html

Source: [bc4jhtmlsrc.zip]\jdeveloper\html\WebBeanImpl.java

Implements: WebBean

Description:

Implements the base methods for a web bean. Extend this class when you define a web bean that doesn't access a data source and that doesn't need to extend another class. One of the options of the Web Bean Wizard is to generate a web bean class that extends this class.


Interface Name: DataWebBean

Package: oracle.jdeveloper.html

Source: [bc4jhtmlsrc.zip]\jdeveloper\html\DataWebBean.java

Extends: WebBean

Description:

Defines the base methods for a data web bean. Implement this interface when you define a web bean that must access a data source (such as a view object that your Business Components project defines) and that must extend another class.


Class Name: DataWebBeanImpl

Package: oracle.jdeveloper.html

Source: [bc4jhtmlsrc.zip]\jdeveloper\html\DataWebBeanImpl.java

Extends: WebBeanImpl

Implements: DataWebBean

Description:

Implements the base methods for a data web bean. Extend this class when you define a web bean that must access a data source and that doesn't need to extend another class. One of the options of the Web Bean Wizard is to generate a web bean class that extends this class. The predefined web beans RowSetBrowser, RowSetNavigator, EditCurrentRecord, InsertNewRecord, ViewCurrentRecord, XMLDataGenerator, and NavigatorBar extend this class.


Class Name: HTMLToolbar

Package: oracle.jdeveloper.html

Source: [bc4jhtmlsrc.zip]\jdeveloper\html\HTMLToolbar.java

Extends: HTMLElementContainer

Description:

Provides methods to dynamically generate an HTML toolbar. The web bean Toolbar extends this class.


Class Name: HTMLTable

Package: oracle.jdeveloper.html

Source: [bc4jhtmlsrc.zip]\jdeveloper\html\HTMLTable.java

Extends: HTMLElementContainer

Description:

Provides methods to dynamically generate an HTML table. The web bean TableControl extends this class.


Class Name: HTMLForm

Package: oracle.jdeveloper.html

Source: [bc4jhtmlsrc.zip]\jdeveloper\html\HTMLForm.java

Extends: HTMLElementContainer

Description:

Provides methods to dynamically generate an HTML form. The web bean EditForm extends this class.


Class Name: HTMLElementContainer

Package: oracle.jdeveloper.html

Source: [bc4jhtmlsrc.zip]\jdeveloper\html\HTMLElementContainer.java

Extends: HTMLElement

Description:

Provides methods to dynamically generate an HTML element. The classes HTMLToolbar, HTMLTable, and HTMLForm extend this class.


Class Name: HTMLElement

Package: oracle.jdeveloper.html

Source: [bc4jhtmlsrc.zip]\jdeveloper\html\HTMLElement.java

Extends: HTMLElement

Description:

This is the base class for all HTML-generating classes. It is never instantiated and simply provides some common services shared by all derived classes. The class HTMLElementContainer extends this class.