Previous Next vertical dots separating previous/next from contents/index/pdf

Building Web Applications: Introduction

BEA Workshop for WebLogic Platform provides tooling support for NetUI: the Apache Beehive framework for web applications. This topic explains the basic concepts behind Beehive NetUI.

Why Use Beehive NetUI?

By using Beehive NetUI, you can avoid making the typical mistakes that often happen during web application development, by separating presentation, business logic implementation, and navigational control. In many web applications, web developers using JSP (or any of the other dynamic web languages such as ASP or CFM) combine presentation and business logic in their web pages.

As these applications grow in complexity and are subject to continual change, this practice leads to expensive, time-consuming maintenance problems, caused by:

NetUI allows you to separate the user interface code from navigational control and other business logic. User interface code can be placed where it belongs, in the JSP files. Navigational control, business logic, and the core functionality of the web application can be implemented in Java controller classes, which form the nerve center of your web application.

The basic division of labor between JSP files and controller classes can be summarized as follows: Java controller classes implement the functionality of the web application; JSP files surface that functionality to the user.

The presentation and processing aspects of a Beehive NetUI web app are highly modular: it's easy to change one without impacting the other. For example, its easy to change the look and feel of the web app by updating the JSP pages with little or no changes required to the underlying controller classes. Similarly, you can re-implement the controller classes without changing the JSP pages, because the core functionality of the web app is encapsulated in the controller classes instead of spread throughout the JSP pages.

The separation of presentation and business logic offers a big advantage to development teams. For example, you can make site navigation updates in a single Java class, instead of having to search through many JSP files and make multiple updates. You can also encapsulate similar web application functions in single Java classes, creating functionally modular web components. This approach to organizing the entities that comprise web applications makes it much easier to maintain and enhance web applications by minimizing the number of files that have to be updated to implement changes, and lowers the cost of maintaining and enhancing applications.

Components of the Beehive NetUI Programming Model

This section gives an overview of the basic parts of the Beehive NetUI implementation.

JSP Files

JSPs form the user interface of a NetUI web application, without the need to include Java code snippets on those pages. In a Beehive NetUI web app, the JSP pages contain JSP tags and references to JSP implicit objects, but no Java code. This makes the application behavior more predictable, testable, and it allows for stricter separation of labor between Java code developers and JSP developers.

Beehive NetUI provides the JSP developer special libraries of JSP tags, the <netui> tag libraries, that supplement the functionality of the standard JSP tag libraries.

The <netui> tag library contains JSP tags specifically designed to work with controller classes (see below). Tags in the library all begin with the prefixes "netui", "netui-databinding", and "netui-template". Some of these tags perform much like familiar HTML tags, while others perform function particular to page flow web applications. The most important feature of the tag library is its ability to refer to data in the controller class. The <netui> tags allow the JSP pages to both read from and write to Java code in the controller class. This is accomplished without placing any Java code on the JSP pages, greatly enhancing the separation of data presentation and data processing.

Java Server Faces (JSF) files can also be added to your web application, either as a replacement or complement to the JSPs.

Controller Classes

Data processing code is contained in Java classes called controller classes. Controller classes handle user navigation through the JSPs in the web application, handle user data submissions, call external resources such as web services and backend databases, and generally implement the core functionality of the web application.

For more infomation on the syntax of Controller classes, see the Apache Beehive documentation: Page Flow Controllers


Actions are methods in the Controller class that has been decorated with specially designed set of metadata annotations, or "annotations" for short. Annotations, a new feature in Java 5, are property setters for methods or classes. Beehive NetUI defines its own set of annotations that allow the controller class to easily communicate with the JSP pages, control navigation with the web application and manage application state.

For more infomation about actions, see the Apache Beehive documentation: Fleshing out the Controller and Actions in NetUI.

Page Flows

JSPs and Controller classes are arranged in modular units called page flows. A page flow consists of a single controller class and any number of JSP files. Typically, a single page flow reflects some unit of functionality within a web application. For example, a company's web application might contain many different page flows, one for browsing the company's catalogue of products, another for collecting the products in a shopping cart, and another for managing customer accounts.

For more information on Page Flow modules, see the Apache Beehive documentation: Nested Page Flows, Page Flow Inheritance, and Shared Flow.

Implicit Objects

Beehive NetUI provides two types of implicit objects that can be used to move data around the application and save application state.

  1. JSP implicit objects: these are the standard set of JSP objects provided by the JSP implementation, such as session, pageContext, etc.
  2. NetUI implicit objects: these objects are provided by the Beehive NetUI framework allowing access to objects in the Controller class, etc.

    For a list of the available objects see: Data binding to NetUI Implicit Objects in the Apache Beehive documentation.

Form Beans

Form Beans are a Java representation of a HTML form. When a user submits an HTML form, the submitted data is captured as a Form Bean and (typically) is passed to an action for further processing.

For more information on Form Beans and their role in a NetUI web application, see NetUI Form Control Tags in the Apache Beehive documentation.

Validation and Exception Handling

Validation and exception handling are defined using a declarative programming model using annotations. For more information see Validation and Exception Handling in the Apache Beehive documentation.

Related Topics

NetUI: Getting Started


Skip navigation bar   Back to Top