1 / 23

Building ADF View Components

Building ADF View Components. 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)

marilyns
Download Presentation

Building ADF View Components

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Building ADF View Components

  2. 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. What Is a JSP? • JavaServer Pages are aJ2EE 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. JavaServer Pages in ADF Calls Request Client JSP Struts Generates Controls Dynamic content ADF Business Components Response

  5. Example: JSP <%@ page contentType="text/html;charset=WINDOWS-1252"%> <html> <head> <title> Show Date </title> </head> <body> <h2> The current time is: </h2> <p> <%= new java.util.Date() %> </p> </body> </html>

  6. Element • Syntax • Purpose • Scriptlets • <% if(x == null) { %> • Hello! <% } %> • Java code • Expressions <%= "a" + "b" %> • Java code that is evaluated • Directives <%@ page language="java" %> • Global values • Declarations <%! private int hitCount = 0; %> • Variable declarations Basic JSP Elements • A JSP can contain HTML text and four main elements:

  7. JSP Directives • There are three types of JSP directives: • page • include • taglib <%@ page contentType="text/html;charset=WINDOWS-1252"%> <%@ include file="signature.html" %> • <%@ taglib uri="webapp/taglib.tld" prefix="mytags" %> <html> <body> <h2> The current time is: </h2> <p> <%= new java.util.Date() %> </p> </body> </html>

  8. 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

  9. 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

  10. 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

  11. 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 <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%> <c:out value="avalue"></c:out>

  12. 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

  13. Struts Tags • The Apache Struts technology containsa custom tag library for use with JSPs. • There are several categories of Strutslibraries available in the ComponentPalette, including: • Struts HTML • Logic • Struts Beans • Templates • Nested • Tiles

  14. 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)

  15. Utilizing the Data Control Palette • Drag components fromthe Data Control Paletteto the Visual Editor of aJSP to display data. • Use the Drop Aslist box to select thestyle of the control.

  16. How Data Is Displayed • JSTL is used to iterate through and display data: • <c:out value="${expr}" /> • <c:forEach var="Row" >…</c:forEach> <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%> <table border="1" width="100%"><tr> <c:forEach var="Row" items="${bindings.OrdersView1.rangeSet}"> <tr><td> <c:out value="${Row.currencyString}"> </c:out> </td>…

  17. 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: • Table • Dynamic Table • Navigation Buttons • Input Form • Read-Only Form • Select Row Link • Graph • Navigation List

  18. 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

  19. 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

  20. 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.

  21. 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.

  22. 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

  23. 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

More Related