Presentation is loading. Please wait.

Presentation is loading. Please wait.

10 Copyright © 2004, Oracle. All rights reserved. Building ADF View Components.

Similar presentations


Presentation on theme: "10 Copyright © 2004, Oracle. All rights reserved. Building ADF View Components."— Presentation transcript:

1 10 Copyright © 2004, Oracle. All rights reserved. Building ADF View Components

2 10-2 Copyright © 2004, Oracle. All rights reserved. Objectives After completing this lesson, you should be able to do the following: Describe how a JSP works Describe the fundamental components of a JSP Create a JSP Include components into JSP (HTML, Struts, and JSTL tags) Create a data-centric JSP using ADF data binding

3 10-3 Copyright © 2004, Oracle. All rights reserved. What Is a JSP? JavaServer Pages are a J2EE component, which: Is a “View” in the ADF MVC structure Contains presentation logic Mixes HTML, Java, and XML in a page Enables Web developers to create applications that focus on the “look and feel” of an application Is based on the servlet architecture Supports the use of custom tags and beans to incorporate presentation logic

4 10-4 Copyright © 2004, Oracle. All rights reserved. JavaServer Pages in ADF Generates Dynamic content Calls ADF Business Components Client Request Response Struts Controls JSP

5 10-5 Copyright © 2004, Oracle. All rights reserved. Example: JSP Show Date The current time is:

6 10-6 Copyright © 2004, Oracle. All rights reserved. Basic JSP Elements A JSP can contain HTML text and four main elements: Global values Directives PurposeSyntaxElement Variable declarations Declarations Java code that is evaluated Expressions Java code Hello! Scriptlets

7 10-7 Copyright © 2004, Oracle. All rights reserved. JSP Directives There are three types of JSP directives: page include taglib The current time is:

8 10-8 Copyright © 2004, Oracle. All rights reserved.

9 10-9 Copyright © 2004, Oracle. All rights reserved.

10 10-10 Copyright © 2004, Oracle. All rights reserved. JDeveloper and JSPs JDeveloper contains several IDE features to simplify JSP development: Visual Editor (WYSIWYG) Component Palette Many Custom Tag libraries are included, including: –JSP Standard Tag Library (JSTL) –Apache Struts –Oracle JSP –ADF Data Tags

11 10-11 Copyright © 2004, Oracle. All rights reserved. The Visual Editor Provides direct editing of: –Text –HTML elements –Data controls The toolbar contains formatting tools for: –Color –Text size –Format (style) You can drag CSS definitions to a page

12 10-12 Copyright © 2004, Oracle. All rights reserved. What Are Custom Tags? Custom tags are developed in Java and defined and used with XML syntax. Tags are used in a JSP to reduce or constrain the amount of Java scriptlets in the page. Tags are useful for defining recurring tasks such as accessing a database or sending an e-mail. Custom tags are packaged into libraries: –Packaged as.jar files –Defined in a.tld file

13 10-13 Copyright © 2004, Oracle. All rights reserved. Utilizing Tag Libraries Tag libraries are utilized in a JSP by: Defining the location of the tag library using the taglib directive Creating a prefix to reference the tag library in the JSP Using the prefix to call a tag and specifying attributes as necessary

14 10-14 Copyright © 2004, Oracle. All rights reserved. JSP Standard Tag Library The JSP Standard Tag Library (JSTL) is being developed under the Java Community Process. It provides a common and standard set of custom tags for: Iteration, conditional processing, and expression language support Parsing and transforming XML documents Formatting and parsing strings, dates, and currencies for internationalization Database access and data manipulation

15 10-15 Copyright © 2004, Oracle. All rights reserved. Struts Tags The Apache Struts technology contains a custom tag library for use with JSPs. There are several categories of Struts libraries available in the Component Palette, including: Struts HTML Logic Struts Beans Templates Nested Tiles

16 10-16 Copyright © 2004, Oracle. All rights reserved. Data Binding Tags The Data Control Palette contains objects that are mapped to the workspace’s business components. The controls may be included in the JSP in different formats, depending on the type of model component they represent: –Input Text (Individual Item) –Input Form (Complete View Object) –Button (Operation such as Commit)

17 10-17 Copyright © 2004, Oracle. All rights reserved. Utilizing the Data Control Palette Drag components from the Data Control Palette to the Visual Editor of a JSP to display data. Use the Drop As list box to select the style of the control.

18 10-18 Copyright © 2004, Oracle. All rights reserved. How Data Is Displayed <c:forEach var="Row" items="${bindings.OrdersView1.rangeSet}"> … JSTL is used to iterate through and display data: …

19 10-19 Copyright © 2004, Oracle. All rights reserved. View Object Control Types Use view object component types to display all data in a view object. Drop the view object as one of the following types of controls: Read-Only Form Select Row Link Graph Navigation List Table Dynamic Table Navigation Buttons Input Form

20 10-20 Copyright © 2004, Oracle. All rights reserved. View Object Item Control Types To display a data control that represents a single view object item, select the item in the Data Control Palette and add it to the JSP as a: Value Label Input Field Password Field

21 10-21 Copyright © 2004, Oracle. All rights reserved. Operations Operations are data actions that interact with an entire view object or an entire application module. They include: Create: Creates a new row in the view object Find: Navigate to a specific row in the view object Delete: Deletes the current row Execute: Submit a query Navigation sets (First Set, Last Set, First, and Next) Commit: Commits an entire application module Rollback: Rolls back changes on an application module

22 10-22 Copyright © 2004, Oracle. All rights reserved. Customizing Controls Select View > Property Inspector to modify the control properties. For operations, you may also double-click the button to modify the name and value.

23 10-23 Copyright © 2004, Oracle. All rights reserved. JSP Versus UIX An ADF view can also be created as a UIX page: More visual components are available in UIX. The Data Control Palette can be used to create data-bound UIX pages.

24 10-24 Copyright © 2004, Oracle. All rights reserved. Summary In this lesson, you should have learned how to: Create JSP pages that use scriptlets, expressions, and declarations to generate dynamic content Incorporate tag libraries in JSP pages to further the component-centric design of JSP applications Add ADF Business Components to a JSP via the Data Control Palette

25 10-25 Copyright © 2004, Oracle. All rights reserved. Practice 10-1: Overview This practice covers the following topics: Creating a JSP for user login Creating navigation to another JSP Creating a JSP for editing and inserting customer data

26 10-26 Copyright © 2004, Oracle. All rights reserved. Practice 10-1

27 10-27 Copyright © 2004, Oracle. All rights reserved. Practice 10-1

28 10-28 Copyright © 2004, Oracle. All rights reserved. Practice 10-1


Download ppt "10 Copyright © 2004, Oracle. All rights reserved. Building ADF View Components."

Similar presentations


Ads by Google