# Advantages of Using Page Flows

This topic outlines the advantages of using page flows in your web applications. You may be familiar already with the Struts framework, which is a part of the Jakarta™ Project by the Apache Software Foundation™. Struts is an open-source framework for building Web applications based on the model-view-controller (MVC) design paradigm. WebLogic Workshop page flows extend the Struts framework to provide a simplified development model with numerous additional features:

- Ease of use

  Typically, native Struts development requires management and synchronization of multiple files for each Action, form bean, and the Struts configuration file. Even in the presence of tools that help edit these files, developers are still exposed to all the underlying plumbing, objects, and configuration details. Page flows provide a dramatically simpler, single-file programming model that allows you to focus on the code you care about, see a visual representation of the overall application flow, and easily navigate between pages, actions, and form beans. Page flows also provide a number of wizards to automate common tasks and visualize tag libraries. Furthermore, page flows provide key programming model benefits like thread safety. As a developer, this means that you can be insulated from some of the complexities that are pervasive in other web development models today like Struts and servlets. The result is that page flows enable you to become immediately productive in building sophisticated web applications, without the learning curve typically associated with Struts.

- Nested page flows

Struts provides a useful framework for smaller applications, but has trouble scaling to larger applications. Every page and action is referenced from a single configuration file, and the manageability of applications and projects quickly degrades as the size of the application increases. But with the nesting feature of page flows, you can easily create smaller nested applications that are linked together, helping to enforce a modular design paradigm and supporting larger team development projects. Importantly, nested page flows automatically manage session state as a user moves between them, ensuring that the minimum possible level of system resources is used.

- State management

Page flows make state management easy. You can put data in session state simply by using a variable in your JPF controller class, unlike with Struts action classes. Or you can easily pass data (as Java beans) to individual pages. Data stored in the session state is automatically freed as a user leaves the page flow for efficient use of session data.

- Rich Data binding features

The WebLogic Workshop data binding tags and wizards make it easy to create rich, dynamic pages within a page flow. These features enable binding of user interface (UI) components to numerous data contexts (not just limited to form beans) and the data may come from any source: a database, a web service, an EJB, a custom application, and so on. In the IDE, you can drag-and-drop the data binding tags to your JSP page and bind to data, including complex types such as method invocations, repeating data, and grids. For more information, see Using Data Binding in Page Flows and Presenting Complex Data Sets in JSPs.

- Service-oriented design with Java controls

Page flows have full support for Java controls, a simple programming model abstraction for accessing enterprise resources and packaging business logic. Java controls give developers access to the powerful features of the J2EE platform (security, transactions, asynchrony) in a simple, graphical environment with methods, events and properties, and enable developers to build Web applications conforming to best practices for service-oriented architecture. For more information, see Tutorial: Java Control.

- Integration with Portal

Have a page flow? You can easily also have a portlet! Page flow applications can be instantly turned into portlets via a wizard in WebLogic Workshop. For more information, see How Do I: Create a Portlet? and How Do I: Add Portal Functionality to an Existing Page Flow Application?

- Strong data typing

Struts treats all data as a String, making it difficult to work with rich form data. Page Flows, on the other hand, allow developers much easier access to strongly-typed data, making it a lot easier to work with form information.

- Powerful exception handling

You can handle exceptions by pointing to local actions in your page flows, Page Flows, and handle not-logged-in errors globally across a set of page flows. This makes it much easier to manage errors and centralized login processes for your entire application versus managing a cloud of exception handler classes in Struts. WebLogic Workshop provides a number of exception types that represent common exception scenarios for page flow applications, such as ActionNotFoundException, LoginExpiredException, and UnfulfilledRolesException. For more information, see Handling Exceptions in Page Flows.

- Iterative development experience

With the WebLogic Workshop IDE and page flows, you do not need to go through the tedious development cycle of edit, build, deploy, and test. Simply make a change in the IDE and click the Run button. The WebLogic Workshop model for automated deployment and integrated testing displays the results of your code change immediately. Plus, more errors are caught up-front through the WebLogic Workshop page flow compiler, instead of discovering the errors at runtime through exceptions or unintended behavior.

- Built on the open-source Struts framework

While page flows provide a number of compelling advantages relative to Struts, keep in mind that page flows are based on Struts. This means that page flows can interoperate with existing Struts applications. You can always use the Struts Merge feature of page flows to obtain full access to underlying Struts artifacts and their configuration details. And page flows can interoperate with existing Struts applications, with both residing in the same web project. Also, with the page flow portability kit, you can run a page flow application on Apache Tomcat™ and any J2EE-compliant Servlet/JSP 2.3 container. For more information about this kit, see the BEA dev2dev.bea.com web site.

Related Topics

Using Form Beans to Encapsulate Data

A Detailed Page Flow Example

Page Flow and JSP Reference