Choosing a Controller Style for a Web Application

Background

Web applications implement flow control by directing the display content of the web browser in response to specific user actions. Typically, web application developers create separate JSP pages or sets of pages for each task the application provides. The user makes choices in one page and clicks a link to submit their choices on the Request object. The link they click directs the Request object to the page responsible for handing the action.

The way your application handles the Request object is a controller design decision you must make. The style of controller you choose will be based on the Model-View-Controller (MVC) design patterns for web applications. JDeveloper supports various levels of sophistication for implementing web application page flow control within the MVC paradigm:

If you want to.... Then choose...

You can write JSP pages that use a combination of HTML generating code and Java scriplet code to link back to themselves and handle the actions. In this case, the entire action handling code is contained in the JSP page that also displays the content. This mixes HTML and flow control logic within the same file.

Working with JSP pages

You can write cleaner appearing JSP pages to accomplish the same task by using a JSP page combined with the ADF data binding lifecycle object that handles the page actions. This affords some separation between HTML for the user interface and the flow control logic. Working with JSP pages or Oracle ADF UIX page and Oracle ADF data binding technology
You can cleanly separate JSP pages and their actions by implementing the controller outside of the JSP page as prescribed by Model 2 of the MVC design pattern for web applications. Working with JSP pages or Oracle ADF UIX page, Struts, and Oracle ADF data binding technology (optional)

Tasks

The process for working controller technologies in JDeveloper varies depending upon the style of application.

To create Model 1 style web applications without Struts and Oracle technologies:

  1. Create the application workspace using the appropriate web application template:
  2. Create the entities of the desired business service.
  3. Create a standard JSP page .
  4. Open the web page in the Visual Editor.
  5. Use the Component Palette to insert HTML and JSP components into the JSP page.
  6. Use the Structure window to browse the elements of the web page.
  7. Use the Property Inspector to modify any attribute of the page's elements.

To create Model 1 style web applications using the Oracle ADF lifecycle:

  1. Create the application workspace using the appropriate web application template:
  2. Create the entities of the desired business service.
  3. Use the New Gallery Web Tier category to create a JSP or ADF UIX page.
  4. Open the web page in the Visual Editor.
  5. Use the Data Control Palette to enable the ADF binding and insert databound UI components into the web page.
  6. Use the Structure window to browse the UI components and data bindings of the web page.
  7. Use the Property Inspector to modify any attribute of the web page's UI components and data bindings.
  8. Use the ADF PageLifecycle class to implement the page flow control for your web page.

To create Model 2 style web applications using Struts and Oracle ADF integration:

  1. Create the application workspace using the appropriate web application template:
  2. Create the entities of the desired business service.
  3. Use the Struts Page Flow Modeler to layout the page flow and create the JSP or ADF UIX pages. The page's extension (.jsp or .uix ) determines the type of page to be created.
  4. Open the web page in the Visual Editor.
  5. Use the Data Control Palette to insert ADF databound UI components into the web page.
  6. Use the Structure window to browse the UI components and data bindings of the web page.
  7. Use the Property Inspector to modify any attribute of the web page's UI components and data bindings.


For information about these standard web technologies in JDeveloper:

Working with JSP Pages
Working with HTML Pages

For information about assembling databound web applications based on the Oracle ADF framework in JDeveloper:

Getting Started with Oracle ADF Applications
About the Oracle ADF Lifecycle Object

Creating a Struts-based Web Application with Oracle ADF
Creating a Model 1 Style Web Page with Oracle ADF

 

Copyright © 1997, 2004, Oracle. All rights reserved.