JavaBeat Certifications Certifications Kits Articles Interview Questions OCAJP 7 OCPJP 5 OCPJP 6 OCEJWCD 6 SCBCD 5.0 SCEA SCJA

Apache Beehive NetUI Features

Topic :
Feedback Request New QnA Print Email

NetUI makes building Java web applications easy and intuitive. When building applications with NetUI, the developer writes Java classes and pages --that's it. There is very little occasion to work with configuration files, or other components. NetUI also excels at separating presentation logic from data processing logic, resulting in uncluttered JSP code which is easy to understand and edit. Data processing and the web application configurables are handled in a single Java class using a simple declarative programming model.

Declarative Programming

Many common web app programming tasks are accomplished through a declarative programming model using "annotations", a new feature in Java 5. Annotations put configuration information (in general, "metadata") right alongside your code, alleviating the need for independent configuration files. Navigation, exception handling, validation, and other tasks are all defined in a single Java class: the Page Flow "controller" class that drives a piece of your web application.

Stateful Page Flows

When a user enters a page flow (by hitting an URL in the page flow's URL space), an instance of the page flow's controller class is created. While the user is in the page flow, the controller instance simply stores the flow-related state in member variables. Methods within the class -- particularly action methods and exception handlers -- have access to the member state. By default, the state is automatically cleaned up when the user leaves the page flow to enter another one. This behavior can be configured per-page flow, but auto-cleanup helps keep your session small, and focused on the task at hand.

Modular Page Flows

A single web application can have multiple page flows within it, allowing you to break up the application into separate, self-contained chunks of functionality. For an example, see the Petstore Sample , which has different page flows for browsing the Petstore, buying products, and handling user accounts.

Inheritance and Shared Flow

Page Flow inheritance is a powerful way to share actions, exception handlers, configuration, etc. among controller classes. It is normal Java inheritance, plus the ability to inherit/merge annotations.

Shared Flow provides an alternative way to make actions and exception handlers available to multiple page flows. The feature is useful for accessing shared state, for shared/templated user interface, and when you cannot change your controller class hierarchy.

Nested Page Flows

An entire page flow can be inserted, or "nested", inside of another page flow. At its heart, nesting is a way of pushing aside the current page flow temporarily and transferring control to another (nested) page flow with the intention of coming back to the original one. Nesting is useful when you want to do one of the following tasks:

  • gather data from the user, for use in the current page flow;
  • allow the user to correct errors or supply additional information en route to executing a desired action;
  • show an alternate view of data represented in the current page flow;
  • bring the user through a "wizard";
  • show the user information that will be useful in the current page flow (e.g., help screens can be easily implemented as nested page flows); and
  • in general, to further break up your application into separate (and in many cases reusable) pieces.

NetUI also offers special integration between nested page flows and popup windows.

Declarative Exception Handling and Validation

Exception handling and data validation are accomplished through a declarative programming model. The desired exception handling and validation behaviors are declared in the controller class (and additionally on form bean classes, for validation) alongside your Java code in the form of metadata annotations. This allows for single file editing and eliminates the need for separate configuration files.

Powerful JSP Tags

NetUI provides three tag libraries: (1) one library represents the core HTML tags, (2) another renders data grids and complex data sets as HTML, and (3) a third library provides page templating functionality.

The NetUI tags also support data binding (1) to JSP implicit objects (through the JSP 2.0 Expression Language) and (2) to other NetUI implicit objects. Note that many tags possess read-write access to these implicit objects.

First-class Integration with JavaServer Faces

NetUI has solid integration with JavaServer Faces. It treats JSF as a first-class view tier, where, for example, JSF components and command handlers can raise Page Flow actions, can databind to NetUI implicit objects, etc.

Struts Integration

Page Flow is built on top of Apache Struts 1.1. Each Page Flow controller is compiled into a Struts module. As a result, NetUI and Struts applications can work closely together.

Struts modules and page flows can co-habitate and interact with one another inside a web app. To forward from a page flow to a (pure) Struts module, simply reference the desired action within the Struts module. The same goes for the reverse direction: from a Struts module, simply configure an action to point to the desired method in the page flow.

You can also use the Struts merge feature to read configuration data from a pure Struts app into your Page Flow app's configuration files. Ordinarily, your Page Flow's configuration files are generated entirely from your application's JAVA source files (specifically from the metadata annotations that decorate the controller classes). But, in cases where you want to integrate a Struts module into your application, you can specify that the configuration files be generated from both the JAVA source files and the Struts module's configuration files, allowing you to change or add any tag in the generated configuration file. For example, suppose you want to override an action form's default scoping from request-scoping to session-scoping. To do this, you simply create a Struts configuration file that overrides the appropriate parts of the Page Flow's configuration file, and then refer to this override file from within the Page Flow's JAVA source file (= the controller class) using a special annotation. In particular, you would specify the override file to state that such-and-such an action form should have session-scope rather then request-scope (so that the action form can now be shared with the Struts app).

Topic :
Feedback Request New QnA Print Email

All api java java 6.0 java 7.0 jdbc jsp servlet ejb jndi jms ejb 3.0 j2ee jee 5.0 jee 6.0 jsf struts spring Hibernate ajax JBoss Seam netbeans eclipse ant xml maven dojo junit javafx j2me log4j ESB JBoss Apache Quartz scjp mysql oracle gwt openjpa jmx yui google-guice android JBoss scwcd 5.0 scjp 1.5 scjp 1.6 scja scbcd 5.0

javabeat | advertise | about us | contact | useful resources
Copyright (2004 - 2013), JavaBeat