Home arrow Graphic Design arrow Page 2 - WebLogic Workshop Application Development Basics
GRAPHIC DESIGN

WebLogic Workshop Application Development Basics


This chapter from BEA WebLogic Workshop 8.1 (Kick Start series, from Sams Publishers, by Albert J. Saganich, Jr., et al., 2004. ISBN: 0-672-32622-1) explores the WebLogic Workshop programming model and introduces enterprise application development.

Author Info:
By: Albert J. Saganich, Jr.
Rating: 4 stars4 stars4 stars4 stars4 stars / 38
June 22, 2004
TABLE OF CONTENTS:
  1. · WebLogic Workshop Application Development Basics
  2. · Page Flow Fundamentals
  3. · Portals
  4. · Creating Applications and Projects
  5. · Workshop Applications Breakdown
  6. · Accessing and Exposing Data via Controls
  7. · Creating Simple Rowset Controls

print this article
SEARCH DEVARTICLES

WebLogic Workshop Application Development Basics - Page Flow Fundamentals
(Page 2 of 7 )

Figure 1 depicted a high-level overview of how WebLogic Workshop applications are structured from a data access and logic perspective. However, when viewed from a navigation perspective, a Workshop application looks different. Figure 3 shows Workshop applications from a Model-View-Controller (MVC) perspective. Behind the scenes, Workshop applications use a Struts-based implementation to provide the presentation and Controller functionality known as Page Flow. In Workshop applications, controls provide the Model component and Page Flows provide the View and Controller components.

saganich

Figure 3 - The Model-View-Controller view of a Workshop application.

Page Flows enable developers to quickly, easily, and (perhaps most important) visually define page transitions between pages of an application. Page Flows are defined within a Page Flow Controller, indicated with a .jpf extension, as well as HTML and JSP pages. Pageflows representing the controller aspect of MVC applications, controls the model and HTML and JSP presentation. Figure 3.4 shows the Flow View for the simple entry page of the Wonderland Casino. Wonderland offers a number of services, including gaming, eating, accommodations, and relaxing.

saganich

Figure 4 - A simple Page Flow in Flow View.

Fundamentally, a Page Flow is composed of a presentation component via JSP or HTML, data made available through controls, and decision logic accessible through actions. These areas are managed using three specific constructs:

  • Form beans—Capture page data and are provided as input to Actions. Form beans are contained within Page Flows as JavaBean inner classes.

  • Actions—Contain Java code implementing navigation logic, provide access to resources via controls, and use form data via Form beans. Actions are implemented as Controller methods, and the Page Flow engine can pass Form beans to them as input.

  • Forward objects—Define and manage passing navigation control from actions to subsequent pages.

A fourth, and often overlooked, area of Page Flows is that of initial page population. Before users can make any decision about what page to move to next, they often need some data. Pages can display data based on Page Flow variables and Form beans, using a combination of NetUI JSP tags and XScript. NetUI tags are closely integrated into Page Flow and described in detail in Chapters 4, "Developing with Page Flow," and 6, "Introduction to WebLogic Workshop Controls and Components." In Page Flows, XScript is used as a mechanism for accessing variables. XScript expressions can be written to navigate arrays of data or arbitrary XML. Listing 1 shows the JSP page representing the starting point of the Wonderland Casino. The netui anchor tags shown in the second and third shaded code lines in Listing 1 render visually as URL links but provide the name of the action that the Controller should call when they're clicked. The first shaded code line shows an XScript expression accessing a pageFlow variable.


Opening and Building Chapter 3 Source - The complete source for the Chapter 3 examples can be found on the CD accompanying this book. To examine, build, or run the example, choose File, Open, Application from the WebLogic Workshop menu, or double-click the .work file in the exampleWebapp directory.


Listing 1 The index.jsp Page

<!--Generated by 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"%>

 <netui:html>
  <head>
    <title>
       <netui:label value="{pageFlow.mainTitle}"/> Main Page.
    </title>
  </head>
  <body>
    <p>

  <h1><center> Welcome to the <netui:label value="{pageFlow.mainTitle}"/> .
  </center></h1>
  <table border="1">
    <tr>
      <td>Would you like to:</td>
    </tr>
    <tr>
      <td>
      <netui:anchor action="gamble">
      Try your luck at our tables of chance and skill!</netui:anchor>
      </td>
    </tr>
    <tr>
      <td>
      <netui:anchor action="relax">Relax in out fine spa!</netui:anchor>
      </td>
    </tr>
  </table>
 
  </body>
</netui:html>

Listing 2 shows portions of the Controller pictured in Figure 5. Examining Listing 2, you can see that the first line in the shaded code section defines the String variable used by index.jsp to display the main page caption. The netui:label JSP tag displays text and can take input from a variable via the datasource attribute—in this example, the parent pageFlow variable mainTitle is used as the datasource. Two actions are defined in the shaded code section: begin and gamble. Examining the gamble action, you can see that the @jpf:forward annotation defines the page that the success operation should forward to on success. When the forward object is created, the @jpf:forward annotation directs the forward object to the Gambling.jsp page. All this code is created automatically when WebLogic Workshop is used to create the Page Flow.

Listing 2 Portions of Controller.jpf

  public String mainTitle ="Wonderland Casino";

 
  /**
   * @jpf:action
   * @jpf:forward name="index" path="index.jsp"
   */ 
  protected Forward begin()
  {
    return new Forward("index");
  }


  /**
   * @jpf:action
   * @jpf:forward name="success" path="Gambling.jsp"
   */
  protected Forward gamble(GambleForm form)
  {
    return new Forward("success");
  }
...
 /**
  * FormData get and set methods can be overwritten by the Form bean editor.
  */
  public static class GambleForm extends FormData
  {
    private String bet;
     private String table;

   public void setTable(String table)
    {     this.table = table;
    }

   public String getTable()
    {
      return this.table;
    }

...
}

Form beans are the most commonly used mechanism for gathering data from a page. To create them, you use the Form bean editor in Workshop. A Form bean can be added to a page by dragging a netui:form tag onto a JSP and then associating it with a Form bean. When a user clicks the Form button, the data is packaged up and provided to the action. Figure 5 shows the Action View of a simple Controller using a Form bean. The index page contains a NetUI form element that gathers gambling data. When the form's Gamble button is clicked, the GambleForm data is passed to the gamble action, and the action can access the data.

saganich

Figure 5 - A simple Page Flow in Action View. 

samsThis chapter is from BEA WebLogic Workshop 8.1, by Albert J. Saganich, Jr., et al. (Apress, 2004, ISBN: 0-672-32622-1). Check it out at your favorite bookstore today.
Buy this book now.


blog comments powered by Disqus
GRAPHIC DESIGN ARTICLES

- Customizing Wordpress Favicons and Gravatars
- Building Corner Effects with Transparent Bac...
- 3D Graphics Technology: VRML Part I - Introd...
- Creating Visual Effects
- Web Page Design Overview
- Creating Artistic Photographs
- Working with Tools in Paint Shop Pro 8
- Using HTML Quickform for Form Processing
- Introduction to Adobe FrameMaker
- WebLogic Workshop, WebLogic Platform, and th...
- Planning the Site
- Working with Web Services
- WebLogic Workshop Application Development Ba...
- Scanning Images for Web Use
- Web Graphics Overview

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials