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.
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
, 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,
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
allow the user to correct errors or supply
additional information en route to executing a
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
Declarative Exception Handling and Validation
Exception handling and
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
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.
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
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
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
the JAVA source files
the Struts module's configuration files, allowing you to
change or add
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).