April 22, 2019
Hot Topics:

Dissecting Java Page Flows

  • August 24, 2005
  • By Kunal Mittal & Srinivas Kanchanavally
  • Send Email »
  • More Articles »

BEA originally launched the Java Page Flow technology with WebLogic Workshop. BEA also introduced a related technology, NetUI, which is a set of tag libraries that provide a binding between Java Page Flows (the controller layer) and Java Server Pages (the presentation layer). NetUI in Apache Beehive is a combination of the NetUI tag libraries and Java Page Flows. (In fact, we could have called this article "Dissecting NetUI.")

Note: In this article, we'll refer to these two components as separate pieces. So, whenever we say Page Flows, we simply mean Java Page Flows. Whenever we say NetUI, we mean the NetUI tag libraries.

In this article, from my book Pro Apache Beehive published by Apress, you'll look at the basic architecture of Java Page Flows and NetUI tags. You'll see the original Page Flows in WebLogic Workshop and then look at the Beehive version. You'll learn about the overall architecture, the classes, and the APIs you'll need to use to leverage Java Page Flows and NetUI.

The intent of this article, is to introduce you to these technologies. Even if you've already worked with Page Flows in WebLogic Workshop, we recommend at least skimming through this article to get a basic overview of the differences between the two versions (WebLogic Workshop Page Flows and Beehive Page Flows). Even if you're an expert on the WebLogic Workshop version, or even if you're an expert on Beehive itself, you'll find this article useful as a ready-to-use reference/refresher.

Introducing Java Page Flows

In the typical Model-View-Controller (MVC) design pattern, Java Page Flows form the controller layer. They're assisted by the NetUI tag libraries in the presentation layer. Java Page Flows are built on top of Struts—which, as you know, is one of the most widely adopted MVC frameworks available today. So, why not just use Struts?

Java Page Flows leverage the core functionality of Struts but remove a lot of the grunt work you have to do with Struts. By grunt work, we mean managing the deployment configuration files (such as the struts-config.xml file). The original version of Page Flows from BEA introduced a declarative programming language that was automatically generated and maintained by WebLogic Workshop. The Apache Beehive version of Page Flows uses JSR 175 for its metadata definition.

As mentioned, Page Flows leverage all the features of Struts, such as the validation framework. You can actually have a single Web application that has a combination of Struts and Page Flows.

So, let's actually look at a Page Flow.

Page Flows in WebLogic Workshop

This article is not about WebLogic Workshop, so we won't go into the details of how you start building Page Flows in WebLogic Workshop. Let's just assume that you built a simple HelloWorld Page Flow using WebLogic Workshop (see Listing 1).

Note: See the BEA Web site (http://www.bea.com) for information on how to download and install BEA WebLogic Workshop 8.1. See the documentation on the BEA developer site (http://edocs.bea.com) to learn how to work with BEA Page Flows.

Listing 1. helloworld.jpf in WebLogic Workshop

package helloworld;
import com.bea.wlw.netui.pageflow.Forward;
import com.bea.wlw.netui.pageflow.PageFlowController;
 *@jpf:view-properties view-properties::
 *<!--This data is autogenerated.
 *Hand-editing this section is not recommended.-->
 *<pageflow-object id="pageflow:/helloworld/
 *<pageflow-object id="action:begin.do">
 *<property value="80" name="x"/>
 *<property value="100" name="y"/>
 *<pageflow-object id="forward:path#success#helloworld.jsp
 *   <property value="44,20,20,60" name="elbowsX"/>
 *   <property value="92,92,-4,-4" name="elbowsY"/>
 *   <property value="West_1" name="fromPort"/>
 *   <property value="North_1" name="toPort"/>
 *   <property value="success" name="label"/>
 *<pageflow-object id="page:helloworld.jsp">
 *   <property value="60" name="x"/>
 *   <property value="40" name="y"/>
public class HelloWorldController extends PageFlowController

   //Uncomment this declaration to access Global.app.
   //protected global.Global globalApp;
   //For an example of Page Flow exception handling,
   //see the example "catch"and "exception-handler"
   //annotations in {project}/WEB-INF/src/global/Global.app
    *This method represents the point of entry into the Page Flow
    *@jpf:forward name="success" path="helloworld.jsp"
   protected Forward begin()
      return new Forward("success");

Notice that this code snippet is mostly full of Java comments. These are the different annotations that support the execution of the actual Page Flow.

All Page Flows have a begin method. This is similar to the main method in a Java class. In this example, the begin method does only one thing: it directs you to the helloworld.jsp page. Listing 2 shows this JSP.

Listing 2. helloworld.jsp in WebLogic Workshop

<%@page language="java" contentType="text/html;charset=UTF-8"%>
<%@taglib uri="netui-tags-databinding.tld"prefix="netui-data"%>
<%@taglib uri="netui-tags-html.tld"prefix="netui"%>
<%@taglib uri="netui-tags-template.tld"prefix="netui-template"%>
         WebLogic Workshop - Hello World
         Hello World !!

This JSP is simple enough. You can easily compile and deploy this Page Flow from within WebLogic Workshop and see its execution.

Note: BEA WebLogic 9.x (http://e-docs.bea.com) will be based on the Apache Beehive version of Page Flows rather than the proprietary version of Page Flows you'll find in BEA WebLogic 8.1.

Now, let's see the same Page Flow in Apache Beehive.

Page 1 of 3

Comment and Contribute


(Maximum characters: 1200). You have characters left.



Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Thanks for your registration, follow us on our social networks to keep up-to-date