oracle jdeveloper 10g build applications with adf instructor guide - volume 2.pdf
Post on 05-Jul-2018
223 Views
Preview:
TRANSCRIPT
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
1/256
D16975GC10
Production 1.0
May 2004
D39415
Oracle JDeveloper 10g: Build
Applications with ADF
Instructor Guide • Volume 2
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
2/256
Copyright © 2004, Oracle. All rights reserved.
This documentation contains proprietary information of Oracle Corporation. It is
provided under a license agreement containing restrictions on use and disclosure and
is also protected by copyright law. Reverse engineering of the software is prohibited.
If this documentation is delivered to a U.S. Government Agency of the Department of
Defense, then it is delivered with Restricted Rights and the following legend is
applicable:
Restricted Rights Legend
Use, duplication or disclosure by the Government is subject to restrictions for
commercial computer software and shall be deemed to be Restricted Rights software
under Federal law, as set forth in subparagraph (c)(1)(ii) of DFARS 252.227-7013,
Rights in Technical Data and Computer Software (October 1988).
This material or any portion of it may not be copied in any form or by any means
without the express prior written permission of Oracle Corporation. Any other copying
is a violation of copyright law and may result in civil and/or criminal penalties.
If this documentation is delivered to a U.S. Government Agency not within the
Department of Defense, then it is delivered with “Restricted Rights,” as defined in
FAR 52.227-14, Rights in Data-General, including Alternate III (June 1987).
The information in this document is subject to change without notice. If you find any
problems in the documentation, please report them in writing to Education Products,
Oracle Corporation, 500 Oracle Parkway, Box SB-6, Redwood Shores, CA 94065.Oracle Corporation does not warrant that this document is error-free.
All references to Oracle and Oracle products are trademarks or registered trademarks
of Oracle Corporation.
All other products or company names are used for identification purposes only, and
may be trademarks of their respective owners.
Authors
Gary Williams
Lynn Munsinger
Patrice Daux
Technical Contributors
and Reviewers
Jeff Gallus
Pam Gamer
Duncan Mills
Publisher
Joseph Fernandez
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
3/256
Preface
I Introduction
Objectives I-2Course Overview I-3
1 Oracle Application Development Framework
Objectives 1-2
J2EE Platform 1-3
Benefits of the J2EE Platform 1-5
J2EE Platform: Architecture Details 1-6
Building J2EE Applications 1-7
What Is Framework-Based Application Development? 1-8
Understanding Framework-Based Application Development 1-9
Oracle Application Development Framework 1-10Visual and Declarative Development 1-11
Design Patterns 1-12
Model-View-Controller Architecture 1-13
MVC Structure 1-14
What Is the Model? 1-15
The Model Layer 1-16
Components of the Model Layer 1-17
What Is the Controller? 1-18
Struts in JDeveloper 1-19
Controller: Summary 1-20
What Is the View? 1-21
View Concept 1-22
View Technologies in Oracle JDeveloper 10g 1-23
View: Summary 1-24
ADF Technology Stack 1-25
ADF: Summary 1-26
Summary 1-27
2 ADF Development Process
Objectives 2-2
Project Technology Scopes 2-3 ADF Technology Stack 2-4
A Sample Application 2-5
Building an Application 2-6
Application Workspaces 2-7
Application Workspace Templates 2-8
Contents
ii i
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
4/256
Creating an Application Workspace 2-9
New Application Workspace 2-10
Design the Business Services for the Model: ADF Business Components 2-11
Design the Application Page Flow 2-13
Create the Page Flow 2-14
Create JSP Pages 2-15Using the Visual Editors 2-16
Databinding: Example 2-17
Adding HTML to Enhance the User Interface 2-18
Results 2-19
Summary 2-20
Practice 2-1: Overview 2-21
3 Getting Started with ADF Business Components
Objectives 3-2
ADF Technology Stack 3-3
What Are ADF Business Components? 3-4
ADF Business Components 3-5
Benefits of ADF Business Components 3-6
Business Components 3-7
Business Domain Components 3-8
Data Model Business Components 3-9
Business Components Model 3-10
Building a Business Components Model 3-11
Creating a Database Connection 3-12
Creating ADF Business Components: Entity Objects 3-13
Creating ADF Business Components: View Objects 3-16Creating Custom Views 3-18
Selecting the Attributes 3-19
Creating an Application Module 3-20
Testing the Business Components 3-21
Summary 3-22
Practice 3-1: Overview 3-23
4 Building Business Logic
Objectives 4-2
Business Logic Validation 4-3
Implementing Validation in the Business Services Tier 4-4Entity Object: Overview 4-5
Entity Object 4-6
Creating an Entity Object 4-7
Entity Object Wizard 4-8
Files Generated for the Customers Entity Object 4-9
iv
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
5/256
Optional Files Generated for the Customers Entity Object 4-10
Using the Business Components Modeler for Entity Objects 4-11
Assigning an Initial Value to an Entity Attribute 4-13
Mapping an Attribute to a Database Sequence 4-14
Practice 4-1: Overview 4-15
Practice 4-1 4-16 Adding Validation 4-19
Declarative Validation Rules 4-20
Li st Val i dat or : Example 4-21
Adding Uni queKeyVal i dat or to an Entity 4-22
Domains 4-23
Domains: Example 4-24
How to Create a Domain 4-25
How to Use a Domain 4-26
Summary 4-27
Practice 4-2: Overview 4-28
5 Exposing Business Data
Objectives 5-2
View Object in the ADF Architecture 5-3
Overview 5-4
View Objects 5-5
Interaction Between Views and Entities: Retrieving Data 5-6
Interaction Between Views and Entities: Updating Data 5-7
Synchronization of View Objects 5-8
Creating a View Object Using the View Object Wizard 5-9
Classes Related to View Objects 5-10Files Generated for the Li neI t emVi ewView Object 5-11
Example of a View Object 5-12
Practice 5-1: Overview 5-13
Practice 5-1 5-14
Calculated Attributes in Views 5-17
View Links 5-18
Traversing Links 5-19
Using the Business Components Modeler for View Objects (I) 5-20
Using the Business Components Modeler for View Objects (II) 5-21
Application Module in the ADF Architecture 5-22
Application Modules 5-24
Creating an Application Module Using the Application Module Wizard 5-25
Using the Business Components Modeler for an Application Module (I) 5-26
Using the Business Components Modeler for an Application Module (II) 5-27
Summary 5-28
Practice 5-2: Overview 5-29
v
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
6/256
6 Adding Custom Validation
Objectives 6-2
Overview 6-3
Adding Validation to an Entity 6-4
Validating Attributes 6-5
Creating a Met hodVal i dat or for an Attribute 6-6Utilizing Typesafe Methods 6-8
Validating Entity Objects 6-9
Call Ent i t yI mpl Methods 6-11
Validation Order 6-12
Associations 6-13
Association Example 6-15
Accessor Methods 6-16
Association Types 6-17
Determining the Association Type 6-18
Creating Entity Associations 6-19Traversing Associations: Destination to Source 6-23
Traversing Associations: Source to Destination 6-24
Summary 6-25
Practice 6-1: Overview 6-26
7 Providing for Efficient Queries
Objectives 7-2
Overview 7-3
Expert Mode View Objects 7-4
Mapping Attributes in Expert Mode 7-5
Maintaining Attribute Mappings in Expert Mode 7-6SQL-Based View Objects 7-7
Creating a SQL-Based View Object 7-8
Implementing Custom Methods 7-9
Expose Methods to the Client Application 7-10
Creating a Test Client 7-11
Instantiating an Application Module 7-12
Instantiate a View Object and Output Data 7-13
Calling Custom Methods 7-14
Setting Parameters for the Wher e Clause 7-15
Assigning Values to Queries with Parameters at Run Time 7-17
Creating a Test Client – Sample Code 7-18
Creating a View Object at Run time 7-20
Finding Data by a Row Key 7-22
Summary 7-23
Practice 7-1: Overview 7-24
vi
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
7/256
8 Making the Model Secure
Objectives 8-2
Goals of J2EE Security Architecture 8-3
Overview of J2EE Security Architecture 8-4
Java Authentication and Authorization Services 8-5
JDeveloper, JAAS, and Securing the ADF Model 8-8Enabling JAAS Authentication for ADF Business Components 8-9
The j bo. secur i t y. enf or ce Application Property 8-10
Setting Entity Permissions 8-11
Entity Privileges 8-12
Attribute Permissions 8-13
Using the Business Components Browser 8-14
Testing Entity and Attribute Authorization 8-15
Summary 8-16
Practice 8-1: Overview 8-17
9 Controlling an Application with Struts
Objectives 9-2
The Controller 9-3
ADF Implements MVC Using the Struts Controller 9-4
Purpose of a Controller 9-5
Example: Page Flow Without a Controller 9-6
Example: Page Flow with a Controller 9-10
What Is Struts? 9-12
Struts Components 9-13
Struts Components Flow 9-15
Struts Components: The Controller Servlet 9-16Struts Components: The Configuration file 9-17
Struts Components: Actions 9-18
Struts Components: Act i onFor ms (Form Beans) 9-19
Struts Components: Tag Libraries 9-20
Application Resources File 9-21
Internationalizing Your Application 9-22
Struts in Oracle JDeveloper 10g 9-23
Struts Configuration File 9-24
Defining the st r ut s- conf i g. xml File Content 9-25
Creating a Page Flow Diagram 9-28
Struts Components: Actions 9-29
Struts Components: Pages and Page Forwards 9-30
Struts Components: Forwards and Links 9-31
ADF Components: DataAction and DataPage 9-32
Summary 9-33
Practice 9-1: Overview 9-34
vii
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
8/256
10 Building ADF View Components
Objectives 10-2
What Is a JSP? 10-3
JavaServer Pages in ADF 10-4
Example: JSP 10-5
Basic JSP Elements 10-6JSP Directives 10-7
JDeveloper and JSPs 10-10
The Visual Editor 10-11
What Are Custom Tags? 10-12
Utilizing Tag Libraries 10-13
JSP Standard Tag Library 10-14
Struts Tags 10-15
Data Binding Tags 10-16
Utilizing the Data Control Palette 10-17
How Data Is Displayed 10-18View Object Control Types 10-19
View Object Item Control Types 10-20
Operations 10-21
Customizing Controls 10-22
JSP Versus UIX 10-23
Summary 10-24
Practice 10-1: Overview
11 Customizing Actions
Objectives 11-2
Struts Configuration File 11-3Creating the Action Class 11-4
Default Code of an Action 11-5
Forwards 11-6
Act i onFor war d of an Action Class 11-7
Creating Global Forwards 11-8
Form Beans 11-9
Creating a Static Form Bean 11-11
Example: Static Form Bean 11-12
Dynamic Form Beans 11-13
Creating a Dynamic Form 11-14
Using the Bean in an Action 11-15
Sample Page Flow 11-16
Sample Page Flow: Struts Elements 11-17
Sample Page Flow: Form Bean 11-19
Sample Page Flow 11-21
Sample Page Flow: Action Class 11-22
viii
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
9/256
Sample Page Flow 11-23
Form Beans, Data Actions, and Data Pages 11-24
Summary 11-25
Practice 11-1: Overview 11-26
12 Using ADF Struts ComponentsObjectives 12-2
What Are Data Actions? 12-3
What Are Data Pages? 12-4
Utilizing Data Pages 12-5
Creating Data Pages 12-6
Creating the View Component 12-7
Displaying Data 12-8
Modifying the Iterator 12-10
Adding Methods to Data Actions 12-11
Adding Methods to Data Pages 12-12
Navigating in Data Pages 12-13
Data Action Life Cycle 12-14
The Data Action Lifecycle 12-15
Customizing Data Actions 12-16
Data Action Events 12-17
on Example: Built-in Events 12-19
on Example: Custom Events 12-20
Forwards and Events in ADF Applications 12-21
Summary 12-22
Practice 12-1: Overview 12-23
13 Adding Validation and Error Handling
Objectives 13-2
Overview of Validation 13-3
Need for Validation 13-4
Client-Side Validation 13-5
Form Bean Validation Method 13-6
Creating the Error Message 13-7
Printing Errors in the JSP 13-8
Validating Actions 13-9
Creating a Validation Class 13-10
The execut e( ) Method 13-11Validation Results 13-12
Struts Validator 13-13
Setting Up the Struts Validator 13-14
Utilizing the Struts Validator 13-15
val i dat i on. xml : Example 13-17
ix
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
10/256
Struts Validator Output 13-18
Exception Handling 13-19
JavaScript 13-20
Enhancing the View 13-21
Summary 13-22
Practice 13-1: Overview 13-23
14 Enhancing the User Interface
Objectives 14-2
Modifying Visual Component Properties 14-3
Using the Toolbar to Format Objects 14-4
Using the Property Inspector 14-5
Adding Images to JSPs 14-6
Using Style Sheets 14-7
Editing Default Style Sheets 14-8
Creating a New Style Sheet 14-9
Editing Style Sheets 14-10
Adding a Style Sheet to the
Component Palette 14-11
Applying a Style Sheet to a Page 14-12
Adding Buttons to a JSP 14-13
Adding Data Control Buttons 14-14
Adding Navigation Buttons 14-15
Adding Form Action Buttons 14-16
Supplementing Button Functionality 14-17
Using Expression Language 14-18
Using EL Attributes 14-19Using EL Literals and Operators 14-20
Using EL Implicit Objects 14-21
Using EL to Customize a Page 14-22
Summary 14-23
Practice 14: Overview 14-24
15 Adding JAAS Security to the Client
Objectives 15-2
JAAS Provider 15-3
Defining Security Needs 15-4
Oracle JAAS Implementation: JAZN 15-5Client Authentication 15-6
Client Authorization 15-7
Basic Authentication Scenario 15-8
Adding JAAS Security to an Application 15-9
Adding Authorization Information to Struts 15-10
x
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
11/256
web. xml Properties 15-11
web. xml Results 15-12
Adding Users and Roles 15-13
Adding Users 15-14
Managing Roles 15-15
Selecting a Specific j az n- dat a. xml File 15-16Running the Application 15-17
Summary 15-18
16 Building ADF UIX View Components
Objectives 16-2
Why ADF UIX Technologies? 16-3
What are ADF UIX Technologies? 16-4
How Do ADF UIX Technologies Work? 16-5
UIX XML Page Layout 16-6
Interface Nodes 16-7
How Is It coded? 16-8
Support for Internationalization 16-9
User Interface Components 16-10
Modular Declarative Design 16-11
Creating a UIX XML Page 16-12
Company and Product Branding 16-13
Page Tabs 16-14
Global Buttons 16-15
Page Footers 16-16
Designing with the Visual Editor 16-17
Coding with the XML Editor 16-18UIX XML Page at Run Time 16-19
Adding Data to the Page 16-20
Design Time Data Components 16-21
Data Binding in the Visual Editor 16-22
Run-Time UIX XML Page with Data Binding 16-23
Summary 16-24
Practice 16: Overview 16-25
17 Deploying an ADF Application
Objectives 17-2
Overview 17-3Overall Considerations for Deployment 17-4
J2EE Archive Format 17-5
Deploying to a Web Server 17-6
Deploying to OC4J 17-7
Install OC4J 17-8
xi
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
12/256
Start the OC4J Server 17-9
Creating an OC4J Connection 17-10
Creating a Deployment Profile 17-12
Deploying to OC4J 17-13
Running Applications 17-14
Customizing Deployment 17-15Summary 17-16
Practice 17-1: Overview 17-17
Appendix A: Course Schema
Appendix B: Practice Solutions
xi i
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
13/256
Copyright © 2004, Oracle. All rights reserved.
Customizing Actions
Schedule: Topic Timing
Lecture 60 minutes
Practice 30 minutes
Total 90 minutes
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
14/256
Oracle10 Forms Develo er: Bui ld Internet A l icat ions 11-2Oracle JDevelo er 10 : Bui ld A l icat ions with ADF 11-2
11-2 Copyright © 2004, Oracle. All rights reserved.
Objectives
After completing this lesson, you should be able to
do the following:
• Describe the Struts XML elements and structure
• Describe the anatomy of an action
• Use the execute method to enhance the behavior
of an action
• Describe the use of form beans
• Use a dynamic form bean
Objectives
In this lesson, you learn more about Struts components in order to create applications that use the
Struts framework to validate user input from an HTML form. You also learn how to create
applications that contain label references, so that labels can be populated at run time based on the
language settings of the client’s browser.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
15/256
Oracle10 Forms Develo er: Bui ld Internet A l icat ions 11-3Oracle JDevelo er 10 : Bui ld A l icat ions with ADF 11-3
11-3 Copyright © 2004, Oracle. All rights reserved.
Struts Configuration File
• Is XML type fi le
• Is the application resource descriptor
• Is used by the servlet to determine actions to
perform
Struts Configuration File
As you have already learned, the Struts Configuration file is the road map of the application.
This is where the logical flow of the application is defined by using XML syntax. It describes
Form Beans, Actions, ActionMappings, resource bundles, data sources, and other parameters.
Note that you can create one or more configuration files per application. However, by default,
JDeveloper creates one configuration file namedst r ut s- conf i g. xml . The name andlocation of the file are specified in the web. xml file for the application.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
16/256
Oracle10 Forms Develo er: Bui ld Internet A l icat ions 11-4Oracle JDevelo er 10 : Bui ld A l icat ions with ADF 11-4
11-4 Copyright © 2004, Oracle. All rights reserved.
Creating the Action Class
• In the context menu, select “ Go to Code.”
• Or, double-click the action.
• Specify a name for the action.
/auth
Creating an Action
An action is an adapter between the contents of an incoming HTTP request and the
corresponding business logic that should be executed to process this request. The action package
is the core of the Struts framework, representing the controller layer of a Model-View-Controller(MVC) model. All actions are subclassed from or g. apache. st r ut s. act i on. Act i on.
The XML definition of an action in the st r ut s- conf i g. xml file is:
The path name appearing on the Page Flow Diagram is a logical name, where the name specified
in the Create Struts Action dialog box is the physical name.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
17/256
Oracle10 Forms Develo er: Bui ld Internet A l icat ions 11-5Oracle JDevelo er 10 : Bui ld A l icat ions with ADF 11-5
11-5 Copyright © 2004, Oracle. All rights reserved.
Default Code of an Action
public class AuthUserAction extends Action{
/* This is the main action called from the Struts
framework.*/
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
{
return mapping.findForward("success");
}
}
Default Java Code of an Action
When creating an action, JDeveloper generates Java code as shown above.
In this example, Aut hUser Act i on extends the Struts act i on class. The execut e( )
method is where you add your own code for customization, and then return an
Act i onFor ward (also called a page forward) to continue the flow of the application.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
18/256
Oracle10 Forms Develo er: Bui ld Internet A l icat ions 11-6Oracle JDevelo er 10 : Bui ld A l icat ions with ADF 11-6
11-6 Copyright © 2004, Oracle. All rights reserved.
Forwards
Forwards can be defined:
• By using the Page Flow
Diagram
• In the XML file
• In the Structure pane
/authUser
success
failure
/page1
/page2
Forwards
Forwards control the flow of an application. One or more forwards are generally defined within
the element in the XML and these, along with any global forwards (defined in thesection of the XML), are valid places for that action to forward to.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
19/256
Oracle10 Forms Develo er: Bui ld Internet A l icat ions 11-7Oracle JDevelo er 10 : Bui ld A l icat ions with ADF 11-7
11-7 Copyright © 2004, Oracle. All rights reserved.
ActionForward of an Action Class
• The return parameter from ActionForward
specifies where to send control.
• The default naming of a single forward issuccess.
• The execute() method can be customized:
– Additional code can be added.
– Other forwards can be specified.
– Appropr iate forward is done on conditional testing.• The forward name represents a logical name.
• A forward can also be a global forward.
ActionForward
The programmer has to return a reference to a forward from the execut e( ) method in theaction. This is done by using the f i ndFor war d( ) method, which accepts the name of the
forward to return to.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
20/256
Oracle10 Forms Develo er: Bui ld Internet A l icat ions 11-8Oracle JDevelo er 10 : Bui ld A l icat ions with ADF 11-8
11-8 Copyright © 2004, Oracle. All rights reserved.
Creating Global Forwards
• A global forward is just like any forward, but it can
be accessed by any action.
• The global forward is defined in the config file.
• The global forward is specified in the action class.
return mapping.findForward("help");
Global Forwards
A global resource, such as a global forward or a global exception, can be used at any time by any
resource.
The links to a global forward are not represented on the page flow.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
21/256
Oracle10 Forms Develo er: Bui ld Internet A l icat ions 11-9Oracle JDevelo er 10 : Bui ld A l icat ions with ADF 11-9
11-9 Copyright © 2004, Oracle. All rights reserved.
Form Beans
User Name
Password
Logon
logonBean
Submit
Logon
authUser
menu
Populates
Form Beans
Form beans are associated with one or more actions. When a page is submitted to the action, the
Struts controller matches parameters from the request object with fields in the form bean class
and populates the bean.
The developer is passed the form bean reference as a parameter to the execut e( ) method ofthe action class, and the values are accessible through get() methods. This saves the developer
from having to query the request. More importantly, the bean can be populated before a page is
displayed and the fields in the page are prepopulated with the relevant fields from the bean that
match the field names in the HTML form—so the process works both ways.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
22/256
Oracle10 Forms Develo er: Bui ld Internet A l icat ions 11-10Oracle JDevelo er 10 : Bui ld A l icat ions with ADF 11-10
11-10 Copyright © 2004, Oracle. All rights reserved.
Form Beans
• A form bean is used to transport data between a
page and an action.
• Can be static:
– Is defined in a FormBean class
– Contains set(), get(), and reset() methods for
each field
– Contains a validate() method for verifying user
input
• Can be dynamic:
– Each field specified in struts.config.xml
– Does not require Java code
Form Beans (continued)
You can create “static” beans, which are your own JavaBeans that extend theAct i onFor m
class and have getters and setters for each field that you want to support. Or, you can do thedeclaration in the Struts XML by using a dynamic bean calledDynaAct i onForm, and without
writing code.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
23/256
Oracle10 Forms Develo er: Bui ld Internet A l icat ions 11-11Oracle JDevelo er 10 : Bui ld A l icat ions with ADF 11-11
11-11 Copyright © 2004, Oracle. All rights reserved.
Creating a Static Form Bean
• Create an action in the Page Flow Editor.
• Right-click and select “ Go to Form Bean.”
• Specify a name (suffix the name with “ Form” ).
• A new icon is displayed.
/authUser
/authUser
Creating a Form Bean
The example above illustrates the creation of a static form bean. This is specified in the
st r ut s- conf i g. xml file as:
The main advantage of using the static form bean is that you can write custom validation code to
check the user input and reset code to initialize the bean. If you do not need these features, then a
dynamic bean is the best.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
24/256
Oracle10 Forms Develo er: Bui ld Internet A l icat ions 11-12Oracle JDevelo er 10 : Bui ld A l icat ions with ADF 11-12
11-12 Copyright © 2004, Oracle. All rights reserved.
Example: Static Form Bean
public class AuthUserActionForm extends ActionForm
{
String username;
public String getUsername()
{ return username; }
public void setUsername(String newUsername)
{ username=newUsername; }
public void reset( …
public ActionErrors validate( …
}
Example: Static Form Bean
In this example, the static bean contains an attribute named “username,” and contains a get and
set method for the attribute. Note that if the val i date( ) method throws an error, the error is
automatically displayed in the JavaServer Page (JSP) that called the page, assuming that theStruts tag exists in the page.
The developer is passed the form bean reference as a parameter to the execut e( ) method ofthe action class. The values are accessible through get() methods. This saves the developer
from having to query the request. More importantly, the bean can be populated before a page is
displayed, and the fields in the page are prepopulated with the relevant fields from the bean thatmatch the field names in the HTML form—so the process works both ways.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
25/256
Oracle10 Forms Develo er: Bui ld Internet A l icat ions 11-13Oracle JDevelo er 10 : Bui ld A l icat ions with ADF 11-13
11-13 Copyright © 2004, Oracle. All rights reserved.
Dynamic Form Beans
• This is an alternative way for an action to have
access to incoming fields from a page.
• The form bean class is not needed.
• There is no need for getter and setter methods.
• The field names are specified in the struts-
config.xml file.
• New f ields can be added dynamically.
Dynamic Form Beans
The dynamic version of a form bean is defined by using the correct type
(org. apache. st r ut s. act i on. DynaAct i onForm) in the st r ut s- conf i g. xml fileand then creating one tag per field in the dynamic bean class. You can
also define an initial value for each of these fields. There is no bean-level validation with adynamic bean. To include bean-level validation, use theexecut e( ) method of the action.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
26/256
Oracle10 Forms Develo er: Bui ld Internet A l icat ions 11-14Oracle JDevelo er 10 : Bui ld A l icat ions with ADF 11-14
11-14 Copyright © 2004, Oracle. All rights reserved.
Creating a Dynamic Form
1. Create a form bean from the Structure pane.
2. Specifyorg.apache.struts.action.DynaActionForm
as the type for the bean.
3. Create a new form property for each field.
Creating a Dynamic Form
To create a dynamic action form from the Page Flow Diagram, right-click the action, select “Go
to Code,” and specify a name. Then, specify the type for the bean asorg. apache. st r ut s. act i on. DynaAct i onForm, and create a
element for each field in the form.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
27/256
Oracle10 Forms Develo er: Bui ld Internet A l icat ions 11-15Oracle JDevelo er 10 : Bui ld A l icat ions with ADF 11-15
11-15 Copyright © 2004, Oracle. All rights reserved.
Using the Bean in an Action
• Using a static bean:
– Create and cast the ActionForm type
– Use the getXxx() method
• Using a dynamic bean:
– Cast the form object passed to the execute()method to a DynaActionForm type
AuthUserActionForm authForm = (AuthUserActionForm) form;
String username=authForm.getUsername();
String
username=(String)((DynaActionForm)form).get("username");
Using the Bean in an Act ion
The bean allows your action class to have access to the input fields. In the static bean, the
username is retrieved by using the get User name( ) method. In the dynamic bean, theusername is retrieved by casting the “username” object to aDynaAct i onFor mtype.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
28/256
Oracle10 Forms Develo er: Bui ld Internet A l icat ions 11-16Oracle JDevelo er 10 : Bui ld A l icat ions with ADF 11-16
11-16 Copyright © 2004, Oracle. All rights reserved.
Sample Page Flow
success
failure
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
29/256
Oracle10 Forms Develo er: Bui ld Internet A l icat ions 11-17Oracle JDevelo er 10 : Bui ld A l icat ions with ADF 11-17
11-17 Copyright © 2004, Oracle. All rights reserved.
Sample Page Flow: Struts Elements
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
30/256
Oracle10 Forms Develo er: Bui ld Internet A l icat ions 11-18Oracle JDevelo er 10 : Bui ld A l icat ions with ADF 11-18
11-18 Copyright © 2004, Oracle. All rights reserved.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
31/256
Oracle10 Forms Develo er: Bui ld Internet A l icat ions 11-19Oracle JDevelo er 10 : Bui ld A l icat ions with ADF 11-19
11-19 Copyright © 2004, Oracle. All rights reserved.
Sample Page Flow: Form Bean
User Name
Password
Logon
logonBean
Submit
success
failure
Logon
authUser
menu
Sample Page Flow: Form Bean
When the user clicks the Logon button, the controller resolves that the target of the form on the
page is aut hUser . do (the . do extension tells the servlet container that this is a StrutsAction). Because the aut hUser action has an associated bean called l ogonBean (defined by
the name attribute), the controller looks for the bean class (static) or bean definition (dynamic)named l ogonBean.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
32/256
Oracle10 Forms Develo er: Bui ld Internet A l icat ions 11-20Oracle JDevelo er 10 : Bui ld A l icat ions with ADF 11-20
11-20 Copyright © 2004, Oracle. All rights reserved.
Sample Page Flow: Form Bean
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
33/256
Oracle10 Forms Develo er: Bui ld Internet A l icat ions 11-21Oracle JDevelo er 10 : Bui ld A l icat ions with ADF 11-21
11-21 Copyright © 2004, Oracle. All rights reserved.
Sample Page Flow
Passed to
User Name
Password
Logon
logonBean
Submit
Populates
successsuccess
failure
Logon
authUser
menu
Sample Page Flow
The Struts servlet reads the request and looks at the metadata to create a bean populated with the
data out of the input fields in the page. Next, it calls the Aut hAct i on class, which is defined by the t ype attribute in the action definition, and passes the populated form bean to theexecut e( ) method.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
34/256
Oracle10 Forms Develo er: Bui ld Internet A l icat ions 11-22Oracle JDevelo er 10 : Bui ld A l icat ions with ADF 11-22
11-22 Copyright © 2004, Oracle. All rights reserved.
Sample Page Flow: Action Class
public ActionForward execute(ActionMapping mapping,
ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws IOException,
ServletException
{
DynaActionForm LAF = (DynaActionForm) form;
String un = (String)LAF.get("username");
String pw = (String)LAF.get("password");
if (un.equals("Scott")) {
return mapping.findForward("success");
} else
return mapping.findForward("failure");
}
Sample Page Flow: Action Class
Generally, when you write a Struts action, you simply extend the base action and implement a
custom execut e( ) method. The framework passes everything you need into that method,
including:
• A reference to the Struts metadata (ActionMapping), so that you can resolve forwards
• The populated form bean (static or dynamic)
• A reference to the request (and, therefore, the session as well)
• A reference to the response object, so that you can save further data, such as errors, for the
response.In this case, the bean with the user-supplied username and password is passed into the
execut e( ) method. The checkAut h method (not shown) performs the custom validation.
If the validation succeeds, f i ndForward( ) is used to look up the next place to go based on
the “success” forward name. The reference to the failure forward is returned if the validation
fails.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
35/256
Oracle10 Forms Develo er: Bui ld Internet A l icat ions 11-23Oracle JDevelo er 10 : Bui ld A l icat ions with ADF 11-23
11-23 Copyright © 2004, Oracle. All rights reserved.
Sample Page Flow
Passed to
User Name
Password
Logon
logonBean
Submit
Populates
success
failure
Logon
authUser
menu
Sample Page Flow
Lastly, the Struts controller forwards the user to the required page or action, and the new page is
displayed in the browser. The simple page flow example is complete.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
36/256
Oracle10 Forms Develo er: Bui ld Internet A l icat ions 11-24Oracle JDevelo er 10 : Bui ld A l icat ions with ADF 11-24
11-24 Copyright © 2004, Oracle. All rights reserved.
Form Beans, Data Actions, and Data Pages
• ADF creates a form bean automatically when you
create:
– Data actions
– Data pages
• The ADF Form Bean is called a DataForm.
• DataForms do not require custom code:
– No static form bean class is needed.
– No dynamic form bean declaration is needed.• ADF uses these objects to manage form data.
Form Beans, Data Actions, and Data Pages
Data actions and data pages use a specialized form bean for managing form data. This bean is
created automatically when you create a data action or data page. No further coding or
declaration is required, because ADF builds the form bean for you. This specialized form bean is
named DataForm.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
37/256
Oracle10 Forms Develo er: Bui ld Internet A l icat ions 11-25Oracle JDevelo er 10 : Bui ld A l icat ions with ADF 11-25
11-25 Copyright © 2004, Oracle. All rights reserved.
Summary
In this lesson, you should have learned how to:
• Describe the Struts XML elements and structure
• Describe the anatomy of an action
• Use the execute method to enhance the behavior
of an action
• Describe the use of form beans
• Use a dynamic form bean
Summary
In this lesson, you should have learned the XML syntax for the content of thestruts-conf i g. xml file. Additionally, you should have learned about advanced Struts components,
such as actions and form beans, and how to support internationalization of a Struts application.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
38/256
Oracle10 Forms Develo er: Bui ld Internet A l icat ions 11-26Oracle JDevelo er 10 : Bui ld A l icat ions with ADF 11-26
11-26 Copyright © 2004, Oracle. All rights reserved.
Practice 11-1: Overview
This practice covers the following topics:
• Using the Page Flow Diagram
• Adding data actions
• Adding data pages
• Creating form beans
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
39/256
Oracle10 Forms Develo er: Bui ld Internet A l icat ions 11-27Oracle JDevelo er 10 : Bui ld A l icat ions with ADF 11-27
Practice 11-1
In this practice, you create a form bean to hold logon information. That logon information is
passed to an action that performs authentication and returns a customer name if the validation
succeeds.
Start JDeveloper, and open thepr act i ce11 workspace.
1. Create form beans.
a. Open the Page Flow Diagram.
b. In the Structure pane, create a new Form Bean.c. In the Property pane, specifylogonBean as the name and set the type to
org. apache. st r ut s. act i on. DynaAct i onForm.d. In the Structure pane, select thelogon bean and create a new Form Property.
e. In the Property Inspector, set the name property to l ast Name and leave it as aSt r i ng.
f. Create a second Form Property for cust omer I d (leave it as a St r i ng).
2. Create a new view object that validates the customer logon. This view object will accept
two parameters and query the customers table for a combination of both
cust omer Last Name and cust omer I d.
a. Create a view object. Name it AuthenticateView. Remember to create the view
object in the Model project.
b. Select customers as the entity object.
c. Select cust omer I d, cust Fi r st Name, and cust Last Name as the attributes.d. Add a WHERE clause that compares the upper of cust Last Name with the upper of
a parameter AND compares cust omer I d with a second parameter.
e. Make sure to select the Use ? Style parameters check box if you are using the above
syntax.
f. In step 6 of 6, select the Generate Java File option for the View Row class.
g. Click Finish to validate.
h. Add the view toSalesAppModule and remove “1” from the instance name.
SELECT Customers.CUSTOMER_ID,
Customers.CUST_FIRST_NAME,
Customers.CUST_LAST_NAME
FROM CUSTOMERS Customers WHERE upper(Customers.CUST_LAST_NAME)= upper(?)
and Customers.CUSTOMER_ID= ?
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
40/256
Oracle10 Forms Develo er: Bui ld Internet A l icat ions 11-28Oracle JDevelo er 10 : Bui ld A l icat ions with ADF 11-28
Practice 11-1 (continued)
3. Create a data action.
a. Open the Struts Page Flow Diagram.
b. Drag the Data Action icon next to the logon page.
c. Change the name to /authenticateUser.
4. Create a new method to validate customer’s logon by using the view you just created.
a. Select the SalesAppModule node in the Applications Navigator.
b. In the Structure pane, double-click theSal esAppModul eI mpl . j ava node.c. In the Source Editor, create a new method that has the following characteristics:Its signature is:
public String findCustomers(String lastName, String customerId)
(The return parameter is a string of Fi r st Name and Last Name concatenated.)
Note: The code for this method is at the end of this practice.
d. Import any classes necessary.
e. Compile the class, and correct any errors that you may have.
5. Make the method available to client applications.
a. Double-click SalesAppModule to open the Module Properties Wizard.
b. Select the Client Interface node.c. Move the findCustomersmethod from Available to Selected, and click OK.
6. Add the method to theAuthenticateUser data action.
a. Open the Page Flow Diagram.
b. From the Data Control Palette, open theSaleAppModuleDataControlnode.c. Open the Operations node and select the f i ndCust omer s( ) method.
d. Drag the method to theauthenticateUser data action.
7. Set the parameter properties of the data action.
a. In the Structure pane, open the /authenticateUser pane.
b. Select the paramNames[0] node.c. In the Property Inspector, change the value key to
${sessionScope.lastName}.
d. Select the paramNames[1] node.
e. In the Property Inspector, change the value key to${sessionScope.customerId}.
f. Select the resultLocation node.
g. In the Property Inspector, change the value key to${sessionScope.customerName}.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
41/256
Oracle10 Forms Develo er: Bui ld Internet A l icat ions 11-29Oracle JDevelo er 10 : Bui ld A l icat ions with ADF 11-29
Practice 11-1 (continued)
8. Associate the logon page to the data action.a. Open the logon page. b. Select the Source Editor.c. Above the tag, insert the following:
d. Close the form tag after the tag.e. Remove the link to the categories page that you added in an earlier practice.
f. Right-click the logon page on the Page Flow Diagram, and select the RefreshDiagram from Page option. A page link should appear between logon andauthenticateUser.
g. Create a forward going fromauthenticateUser to categories. The Struts diagramshould look something like the diagram below:
9. Run the application starting at thewelcome page. Try to log on with the following valuesof Cust omer Last Name and Cust omer I d:Wel l es 101
Paci no 102 Tayl or 10310. You will enhance this validation in a later practice.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
42/256
Oracle10 Forms Develo er: Bui ld Internet A l icat ions 11-30Oracle JDevelo er 10 : Bui ld A l icat ions with ADF 11-30
Practice 11-1 (continued)
SalesAppModuleImpl.java
public String findCustomers(String lastName, String
customerId)
{
ViewObjectImpl vo = this.getAuthenticateView();vo.setWhereClauseParam(0,lastName);
vo.setWhereClauseParam(1,customerId);
vo.executeQuery();
AuthenticateViewRowImpl row =
(AuthenticateViewRowImpl)vo.first();
String customerName = null;
if (row != null)
{
customerName = row.getCustFirstName() + " " +
row.getCustLastName();
}
return customerName;
}
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
43/256
Copyright © 2004, Oracle. All rights reserved.
Using ADF Struts Components
Schedule: Topic Timing
Lecture 30 minutes
Practice 45 minutes
Total 75 minutes
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
44/256
-
12-2 Copyright © 2004, Oracle. All rights reserved.
Objectives
After completing this lesson, you should be able to dothe following:
• Describe data actions and data pages
• Customize data actions and data pages to
enhance the behavior of an application
• Use data actions to access mult iple types of
business services
• Describe the relationship between databoundpages and data pages
Objectives
Databound applications that contain Oracle ADF business services are created by using data
actions. This lesson discusses how data actions are created, customized, and utilized in a
databound application.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
45/256
-
12-3 Copyright © 2004, Oracle. All rights reserved.
What Are Data Actions?
Data actions are an extension of the action class,which:
• Are provided with Oracle ADF
• Provide access to business services, such as
business components
• Prepare the data and make it available for pages to
consume
What Are Data Actions?
Data actions are an extension of the Struts Act i on class. By default, they provide access to
business services, such as view object business components. Data actions are created in the
Struts Page Flow Diagram and customized by using the Data Control Palette, Structure pane, and
Property Inspector.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
46/256
-
12-4 Copyright © 2004, Oracle. All rights reserved.
What Are Data Pages?
Data pages are an extension of the DataAction class,
which:
• Are provided with Oracle ADF
• Combine a data action and a page forward
• Do not rely on forwards to forward application
data
• Simplify the Page Flow Diagram
What Are Data Pages?
Data pages are an extension of the Dat aAct i on class. They are a combination of a data action
and page forward. For example, if you have a customer view object and want to create a new
customer, you can create a data action based on “Customers” and a page forward based on the
same “Customers” view. Alternatively, you can create a data page based on the “Customers”
view and you have all the benefits of having the data controlled by a Struts controller
component, but with half the number of components.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
47/256
-
12-5 Copyright © 2004, Oracle. All rights reserved.
Utilizing Data Pages
To use a data page, perform these steps:1. Create the data page in the Page Flow Diagram.
2. Double-click to create the corresponding view
object (JSP, HTML, and UIX).
3. Define the Struts page flow as necessary.
4. Add business service methods to the data page as
necessary.
Utilizing Data Pages
To utilize a data page, create it in the Page Flow Diagram. Next, create the corresponding view
component by double-clicking the data page. Next, define the Struts page flow further if
necessary. For example, a browse form may have a link to an insertion form. Then, add methods
as necessary to the data page. These steps are discussed in detail in the slides that follow.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
48/256
-
12-6 Copyright © 2004, Oracle. All rights reserved.
Creating Data Pages
Drag a data page to
the Page Flow
Diagram. The struts-
config.xml file is
updated with the
data action.
/browseCustomer
Creating Data Pages
To create a data page in your application, drag a data page from the Component Palette to thePage Flow Diagram. The st r ut s- conf i g. xml file is updated automatically. Note that the
data page extends
oracl e. adf . cont r ol l er . st r ut s. act i ons. DataFor war dAct i on. In this case, a
data action for browsing the customers view object has been created. The page has not been
associated with a JavaServer Page (JSP) yet, so the data page icon has a caution symbol on the
Page Flow Diagram, and the parameter attribute is “unknown.” The name parameter is not the
name of the data page, but the name of the form bean used to transport data between thecontroller and the view. The “DataForm” bean specified is the generic ADF bean that is
automatically generated. The next step is to create the JSP that displays the data.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
49/256
-
12-7 Copyright © 2004, Oracle. All rights reserved.
Creating the View Component
Double-click the data page to createthe view component.
/browseCustomer
Creating the View Component
Double-click to create the view component. By default, the name of the data page is used as the
file name, with a .jsp extension, but this can be any view component. The parameter attribute is
updated to show the corresponding view component/ br owseCust omer s. j sp. Additionally,the modelReference property is set to br owseCust omer sUI Model , which is the name of the
file that the data page uses to initialize data and methods. The file is not created until data
controls are added to the view component.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
50/256
-
12-8 Copyright © 2004, Oracle. All rights reserved.
Displaying Data
To display data from the data page, add elements fromthe Data Control Palette:
• Bound Data
• Navigation
• Operations
The data controls associated with the data action aredefined in DataBindings.cpx (created automatically).
Displaying Data
The next step in utilizing data pages is to develop the JSP that contains the bound data. Utilize
the Data Control Palette to add data, navigation, and operations to the JSP. Note that the first
time you add a data control to the page, the mappings for all data controls are automaticallygenerated and contained in Dat aBi ndi ngs. cpx.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
51/256
-
12-9 Copyright © 2004, Oracle. All rights reserved.
Displaying Data
Select elements from the Data Control Palette and dragthem to the page:
…
Generated code
Displaying Data (continued)
To display data bound to a view object, select the view or attribute that you want to add to the
page, and select the appropriate Drag and Drop As value. In this example, a table for browsing is
desired, so the Cust omer sVi ewdata control is dragged as a read-only table to thebr owseCust omer s. j sp. This is exactly the same procedure as you have seen in a previouslesson. Note that for each page you bind data to, aUI Model . xml file is created to map theattributes. This uses the name defined in the model Ref er ence property value for the data
page.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
52/256
-
12-10 Copyright © 2004, Oracle. All rights reserved.
Modifying the Iterator
Click the UIModel icon in the Structure pane to locatethe iterator for the model. Then use the Property
Inspector to change the range size.
Modifying the Iterator
To modify the range size of the iterator, locate it by using the UIModel tab of the Structure pane.
You can then set the range size of the iterator as necessary in the Property Inspector. The iterator
provides access to a set of rows within a view object.
Instructor Note
If you set the range size to –1, the iterator returns the entire rowset. The default value is 10.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
53/256
-
12-11 Copyright © 2004, Oracle. All rights reserved.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
54/256
-
12-12 Copyright © 2004, Oracle. All rights reserved.
Adding Methods to Data Pages
Drag and drop methods from theData Control Palette to add
methods to a data page:
setCurrentRowWithKey
Delete
Create
Adding Methods to Data Pages
As shown in the slide, the set Cur r ent RowWi t hKey method is added to the/ edi t Cust omer s data page to enable the data page to display only the currently selected
row. This method is also used to set the currency of the row before deleting the row.
A row is selected in the / br owseCust omer s data page by using a Select Row link, which
passes the current row’s key to a linked page or action. Additionally, the create and delete
methods are used as indicated, for creating new rows and deleting a selected row.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
55/256
-
12-13 Copyright © 2004, Oracle. All rights reserved.
Navigating in Data Pages
• HTML Form tag submits to itself, by default.• Change the action to the page that receives the
form data.
• Use the Property Inspector to change the value of
“action.”
Select the data page or
action that receives the
form data.
Navigating in Data Pages
When you draw a link between pages, you define where the page goes next. However, when you
create an input form by dragging a view object, the form is coded by default to submit to the
same page on which it resides. Thus, this must be changed to enable application flow. Change
the value of the action attribute in the Property Inspector to specify the receiving data page or
data action.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
56/256
-
12-14 Copyright © 2004, Oracle. All rights reserved.
Data Action Life Cycle
1. Initialize context
Get HTTP request Get binding info
2. Build event li st
3. Check for model bindings
4. Check if updates allowed
5. Process updates
6. Validate updates
7. Handle model and UI events
8. Invoke custom methods
9. Refresh binding cont rols
10. Dispatch to forward
Data Action Li fe Cycle
1. Initialize context. The first step handl eLi f ecycl e( ) performs is to initialize the
context. In a Model 1 application, the context is an instance of
oracl e. adf . cont r ol l er . l i f ecycl e. Li f ecycl eCont ext . In a Struts
application, the context is an instance of
oracl e. adf . cont r ol l er . st r ut s. act i ons. Dat aAct i onCont ext , asubclass of Li f ecycl eCont ext . In either case, handl eLi f ecycl e( ) calls the life-
cycle context initialize method. This sets the value of the associated request, binding
container, and life cycle in the context.2. Build event list. Next, handl eLi f ecycl e( ) builds the list of events to be performed
by retrieving them from the request object with the life-cycle method
bui l dEvent Li st ( ) .
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
57/256
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
58/256
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
59/256
-
12-17 Copyright © 2004, Oracle. All rights reserved.
Data Action Events
Built-in operations are listed in the UIModel.xml file:
• Defined by:
– Dragging operation from the Data Control Palette
– Explicit creation in the Structure pane
• Invoked by:
– Button with the name “ event_” ,
for example, event_Commit.
– Hyperlink with a parameter “ event=< operation>” ,for example, event=Commit.
Data Action Events
Built-in operations are the operations such as next, last, insert, and so on, which are available for
an iterator and which can be dragged to a page as a button.
When you drag an operation to a page, a name is generated for the button, which is prefixed with
the string “event_”, followed by the name of the operation itself.
Events can also be passed as hyperlinks by using the URL parameter “event=”, again followed
by the name of the event.
This means that you can add hyperlinks on a JSP that trigger events. You can also add buttons to
a page by dragging operations from the Data Control Palette.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
60/256
-
12-18 Copyright © 2004, Oracle. All rights reserved.
Data Action Events
Using built -in events, you can define your ownoperations:
• Defined by:
– Coding an on()method in the data
action
• Invoked by:
– Button with the name “event_” ,
for example, event_Help.
– Button with the name “ event” and value,
for example, name=“ event” value=“ Help” .
– Hyperlink with a parameter event=< operation>,
for example, event=Commit.
Data Action Events (cont inued)
To utilize custom events, create an on( ) method in the data action. Then,
invoke the event by using the same naming convention as the built-in operations.
This is a technique to extend the default behavior without interfering with the standard event life
cycle.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
61/256
-
12-19 Copyright © 2004, Oracle. All rights reserved.
on Example: Built-in Events
Extending a named buil t-in event
public void onCommit(DataActionContext ctx)
{
HttpSession session = ctx.getHttpServletRequest().getSession();
Boolean loggedOn = (Boolean)session.getAttribute("AUTHFLAG");
if (loggedOn.booleanValue()){
ctx.getEventActionBinding().doIt();
}
}
?event=commit
on Example: Bui lt-in Events
In this example, you can add some logic to a built-in event; for example, allowing the commit
event to take place only if the user is logged in.
Thus, the commit event is triggered through a submit button called “event_commit” or an
argument on the URL (as shown above). This assumes that the UIModel for this data action or
page contains the commit operation.
After the button is pressed, the data action is notified that the commit operation has taken place.The data action then introspects the subclass of data action provided for anonCommi t ( )
method.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
62/256
-
12-20 Copyright © 2004, Oracle. All rights reserved.
on Example: Custom Events
Calling a custom operation
public void onFoo(DataActionContext ctx)
{
// just direct the flow to the "foo" forward
ctx.setActionForward("foo");
}
event=foo
on Example: Custom Events
In addition to built-in operations that are already registered, you can also code custom events thatare again detected by introspection. In this case, the event f oo simply sets the forward for thedata action or page to the target of the f oo forward.
Note that if there is no operation defined for an event, the data action assumes that the event is in
fact identifying a forward. Thus, event =f oo triggers the flow to follow the f oo forward.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
63/256
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
64/256
-
12-22 Copyright © 2004, Oracle. All rights reserved.
Summary
In th is lesson, you should have learned how to:• Create data pages mapped to business services
• Create Web applications that uti lize data pages
• Customize data actions and data pages to
enhance the behavior of an application
Summary
This lesson should have taught you how to utilize data pages and data actions to easily
incorporate business services into a Struts-based Web application.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
65/256
-
12-23 Copyright © 2004, Oracle. All rights reserved.
Practice 12-1: Overview
This practice covers the following topics:• Creating data actions
• Adding methods to data actions
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
66/256
-
Practice 12-1
Adding features to data pages.
Start JDeveloper, and open the pr act i ce12 workspace.
1. In this step, you add navigation operations to thecategories page. The buttons allow the
user to navigate forward or backward through sets of category rows.
a. Open the categories data page.
b. In the Data Control pane, open the SalesAppModuleDataControl node, expand the
CategoriesView node, and then the Operations node.
c. Select the Previous Set item, and drag it to the Design Editor following the last
object. If prompted with an Add Form Element Confirmation dialog box, answer Yes.
d. Perform the same steps and add the Next Set operation, and drag it next to the
Previous Set button.
e. You must include the data table inside the form tag that you just added. Go to theSource tab, find the tag, and move it to just above the tag.
f. Next, set the action property of the form tocategories.do.
2. Modify the iterator so that the page does not display all the items at one time. This makes
the pages more user friendly. If the users do not see the category that they are looking for,they can click one of the buttons to see the next set of records, rather than having to scroll
to see all of the categories.a. In the Applications Navigator, click thecategories.jsp node.
b. In the Structure pane, click the UIModel tab, which is the second tab at the top of the
Structure pane.
c. Click CategoriesViewIterator and set the Range Size value to 5 in the Property
Inspector. This restricts the number of categories displayed on a page to 5.
3. Add navigation operations to the products page.
a. Open the products data page. b. Within the CategoriesView node, expand the ProductInformationView node, and
then the Operations node and add Previous Set and Next Set items as you did for thecategories page. Do not forget to move thetag and set the action property topr oduct s. do.
4. Modify the products iterator to display 5 rows just as you did for the categories iterator.
5. Clean up the unnecessary columns from both pages.
a. In the table created for the view, select the first top left cell, right-click, select Table
from the context menu, and select the delete column option.
b. This removes the current_row column from the table.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
67/256
-
Practice 12-1 (continued)
6. Create a Master Detail Page navigation for thecategories and products pages.
a. In the page flow, delete the link from categories to products that you created earlier.
b. Open the categories page in the Design Editor, and delete the link and message bean.
c. Select the Operations node for the CategoriesView in the Data Control Palette.
d. Drag the setCurrentRowWithKey categories operation as a Find Row Link to the
CategoryName column. (You can choose any column.)
e. Move the “
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
68/256
-
Practice 12-1 (continued)
7. Create a data page for ShoppingCartView that you created in an earlier practice.
a. Add the following entries in theAppl i cat i onResour ces file:l i nk. product s=cont i nue shoppi ngl i nk. cat egor i es=choose anot her cat egory
b. Open the Page Flow Diagram, and create a shoppingCart data page with the default
corresponding jsp.
c. Drag the ShoppingCartView data control as a read-only table to the page.d. Select the Struts Html link tag, and drop it at the bottom of the page. Add a Struts
Bean message tag to the link tag, and set the Key value as l i nk. pr oduct s.Specify /products.do as the action value in the Property Inspector..
e. Select the Struts Html link tag and drop it at the bottom of the page. Add a Struts
Bean message tag to the link tag and specify l i nk. cat egor i es as the Key value.Specify /categories.do as the action value in the Property Inspector.
8. shoppingCartView is designed to hold items that the user chooses to buy from the online
store. The user adds the items by clicking a link on the item. The item is then added to
shoppingCartView. The code to accept these items and add them to the cart is in theshoppingCartViewImpl class. Rather than having you type all the code, the code is
already in the class. The instructions for this portion of the practice are to step you through
the code.a. Make the view object capable of using theFi ndByKey method. Setting this
property to true enables you to search the view object by Key. The benefit of using
this technique is that you do not have to iterate through the rows searching for a
match. That function is already written for you.
protected void create()
{
super.create();
setManageRowsByKey(true);
}
// end of create
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
69/256
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
70/256
-
Practice 12-1 (continued)
c. The f i l l I nCar t I t emDet ai l s( ) method instantiates aProductInformationView and sets its wher e clause to the pr oduct I d of thecurrent car t I t em. It then queries the view object to get the details of the product. Itthen sets the pr oduct Name and l i st Pr i ce of the shoppi ngCar t I t em.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
71/256
-
Practice 12-1 (continued)
d. The f i ndCar t I t em( ) method simply takes a pr oduct I d as an argument, andchecks to see whether it exists in the shoppi ngCar t . If it exists, it returns theshoppi ngCar t I t emrow.
e. The car t Tot al ( ) method returns the total of all the items in the cart. To do this, itcreates a r owSet I t er at or of the shoppi ngCar t and iterates through it,summing the ext endedTot al attributes as it does. At the end of theRowSet I t erat or , it returns the total .
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
72/256
-
Practice 12-1 (continued)
9. After the user has selected the items and added them to the cart, you need to finalize the
order; in other words go through the checkout process. The code creates a single order forthe shoppi ngCar t , and then creates an Or der I t ems row for each row in theshoppi ngCar t This method is in the Sal esAppModul eI mpl class.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
73/256
-
Practice 12-1 (continued)
10. Now that all the code is in place to add items to the cart, calculate the total, and even
finalize the order, you need code to get it all started. This method is published in the
application module so that client applications can access it. All the other methods are usedwithin the context of this one method. This method is theaddToCar t method and is alsoin the Sal esAppModul eI mpl class.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
74/256
-
Practice 12-1 (continued)
11. Now that the code is in place to complete your application, you can add the elements to add
products to the shoppingCart. The result is a link on the product ID that forwards to aDataAction. The DataAction calls the addToCar t method, which adds the product to the
ShoppingCartView object.
a. Add a DataAction to the page flow, and name it /addToCart.
b. Drag the addToCart method from the SalesAppModule to the DataAction.
c. Change the name of the parameter in the addToCart DataAction topar am. pr odI d. (Use the Structure pane and select paramNames[0].)
d. Add a forward from the products page to theaddToCart DataAction and name it
addToCart.
e. Add a forward from the addToCart DataAction back to the products page. Leave the
name as success.12. Next, add an hr ef to the products page that uses the forward you just defined and passes
the pr oduct I d as an argument. Because this is a common activity, create a code snippet
that makes this easier.
a. Open the code snippet list on the Component Palette. b. Right-click and select Add Component.
c. Name the component “an href with an event and argument”
d. Enter the following code snippet: link words
e. Click OK. You are now ready to use this snippet wherever you need.
f. From the Component Palette, select code snippets. In the Design Editor for the
products page, place your cursor just before theproductId value in the read only
table. Now click the an href item in the Component Palette. This adds your code
snippet to the page.
g. Find the code in the Source Editor and change it for your specific application by
replacing myPage, myEvent, myArg, and myValue. Your code should look like:
h. Add a forward from the products page to the shoppingCart page. Name the forward
viewCart.
13. In the Visual Editor on the products page, add anhr ef that calls the forward to the
shoppingCart. The code should look like the following code (You can use the snippetagain.):View your Cart
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
75/256
-
Practice 12-1 (continued)
14. Build and test the application starting at thecategories page.
a. Select a category and notice that theproducts page is coordinated with that category.
b. Go back to the categories page and select another category. Observe the same
behavior.
c. Click a product to add it to the shoppingCart.
d. See that the item is added to the cart.
e. Experiment with multiple items by clicking the same item multiple times.f. When you are done, close the browser.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
76/256
Copyright © 2004, Oracle. All rights reserved.
Adding Validation and Error Handling
Schedule: Topic Timing
Lecture 35 minutes
Practice 30 minutes
Total 65 minutes
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
77/256
-
13-2 Copyright © 2004, Oracle. All rights reserved.
Objectives
After completing this lesson, you should be able to dothe following:
• Validate form input
• Use declarative validation
• Use client-side validation
• Utilize control hints to modify the view
Objectives
Business logic and rules should be enforced in the business tier of an application. However, it is
possible and sometimes useful to validate data at the client level (thus saving the user a round
trip to the server). This provides for an effective and robust user interface. This lesson shows you
how to incorporate client-side validation into the view of a Struts-controlled application.
Additionally, enhancing the view by using control hints is also covered in this lesson.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
78/256
-
13-3 Copyright © 2004, Oracle. All rights reserved.
Overview of Validation
Method Validators,
Control Hints
ADF
BusinessComponentsStrutsForm Bean Struts Action
Form Bean validate()
method, Struts Validator
JSP
JavaScript New Validation Methods
Overview of Validation
Validation can be performed at many levels of an application. You have already seen how to
create validation methods in ADF Business Components by using method validators. However,
there are several ways to incorporate validation in Struts: utilizing the form beanval i dat e( )
method, or by creating custom validation classes and calling their methods from theexecut e( ) method of a Struts action. There is also a plug-in available in Struts, which
incorporates common validation rules. Additionally, simple validation can be performed at the
client level by creating a JavaScript file, which is referenced in the JavaServer Pages (JSP).
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
79/256
-
13-4 Copyright © 2004, Oracle. All rights reserved.
Need for Validation
In Web applications, the user usually does not receivetraining on how to complete fields correctly. Thus, an
application must provide feedback to the user for
these types of actions:
• Entering required values
• Specifying values within a specif ied range
• Comparing values
– For example, Password1 must match Password2.
Need for Validation
Client-side validation enables immediate response to a user interacting within an HTML form.
For example, the response can display an alert when a business rule is violated or correct data if
an entry does not have the desired format. Client-side validation is not meant to replace server-
side enforcement of business and format rules. It should be thought of as a convenience for the
end user to avoid waiting for a server response simply to determine whether the submitted data is
correct.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
80/256
-
13-5 Copyright © 2004, Oracle. All rights reserved.
Client-Side Validation
To perform validation by using Struts, you must:1. Create a form bean class
2. Overwrite the form bean validate() method,
passing an error to the action
3. Create the error message in ApplicationResources.properties
4. Add the input attribute for the form to the action to
indicate where the error message should appear
Client-Side Validation
Validation can be incorporated by using the form bean class of a Struts action. The form beancontains a val i dat e( ) method, where you can define the validation logic. The next step is tocreate a message for the error in the Appl i cat i onResour ces. pr oper t i es file.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
81/256
-
13-6 Copyright © 2004, Oracle. All rights reserved.
Form Bean Validation Method
The form bean contains a validate() method for
validating form f ields. Overwrite this method to
perform custom validation:
public ActionErrors validate(ActionMapping
mapping, HttpServletRequest request)
{
ActionErrors errors = new ActionErrors();
if ((username == null) ||
(username.trim().equals("")))
{
errors.add("username", new
ActionError("error.username.required"));
}
return errors;
}
Form Bean Validation Method
After you have created a form bean class, overwrite theval i date( ) method to perform
validation on form fields. In this example, if the form field “username” is a null value or an
empty string, the er r or . user name. r equi r ed error is passed to the action. The next step isto create a message for this error in the Appl i cat i onResour ces. pr oper t i es file.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
82/256
-
13-7 Copyright © 2004, Oracle. All rights reserved.
Creating the Error Message
• To display the error message, specify themessage in ApplicationResources.properties:
• Define where the error message is to be displayedby using the input attribute:
error.username.required=The Username Value must be
Supplied
Creating the Error Message
To create the error message, add it to the Appl i cat i onResour ces. pr oper t i es file. Inthe example above, this corresponds to Act i onEr r or created in the form bean’s val i date( )method. Note that the val i dat e attribute of the action should be set to “true,” which is the
default.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
83/256
-
13-8 Copyright © 2004, Oracle. All rights reserved.
Printing Errors in the JSP
Ensure that the JSP contains an tag:
Note that you can specify the property attribute of the
tag to print only the correspondingerror:
…
…
Printing Errors in the JSP
The tag must be included in the JSP to display the error. This tag is available
in the Struts HTML category of the Component Palette. There are two ways to display the error,
as shown below.
Specific
(property attribute set)
Generic
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
84/256
-
13-9 Copyright © 2004, Oracle. All rights reserved.
Validating Actions
A second type of validation is to overwrite the executemethod in the action class. This type of validation is
useful when:
• You have previously created classes that check
the validity of a given value
• You do not want the form values to be reset after
validation
• The validation logic is complex
Validating Actions
Instead of validating form input by using theval i dat e( ) method, you can also validatevalues by using the execut e( ) method of the action. This is especially useful if you already
have JavaBeans or other classes that evaluate user input.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
85/256
-
13-10 Copyright © 2004, Oracle. All rights reserved.
Creating a Validation Class
The first step in validating user input is to create amethod for validation. This can be done in a simple
class file, as shown:
package view;
public class LoginValidation
{
boolean checkUsernamePassword(String un, String pw)
{
if ( un.equals("scott") && pw.equals("tiger") )
return true;
else
return false;
}
}
Creating a Validation Class
To validate using the action, you must first create a method for validation. This should be done
outside the action and action form bean classes, in a new file. The example above contains one
method, checkUser namePasswor d( ) , which returns t rue if the username is scot t andthe password is t i ger . This is, of course, a simple example. The code for validating the
username and password in a more complex application can validate based on database values.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
86/256
-
13-11 Copyright © 2004, Oracle. All rights reserved.
The execute() Method
To validate user input in the action class, overwri te theexecute() method, calling your validation method:
public ActionForward execute…
{
LogonActionForm logonForm = (LogonActionForm) form;
String un = logonForm.getUsername();
String pw = logonForm.getPassword();
LoginValidation loginvalidation = new
LoginValidation();
if ( loginvalidation.checkUsernamePassword(un,pw))
{
return mapping.findForward("success");
} else return mapping.findForward("failure"); }
The execute() Method
Call the validation method that you have created in theexecut e( ) method of the action class.
To access the values of the form fields, create an instance of the form bean and utilize theget() methods in the form bean. This example uses the f i ndFor war d( ) method to direct
the user to the appropriate page. You can then use the Struts logic tags to determine whether the
user entered incorrect data, and display a helpful message if the user is attempting a login for the
second time.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
87/256
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
88/256
-
13-13 Copyright © 2004, Oracle. All rights reserved.
Struts Validator
Declaratively validate form fields by using the StrutsValidator. The validator plug-in:
• Is XML based
– validator-rules.xml (Validation rules)
– validations.xml (Usages)
• Defines rules for each f ield in a form bean
• Can provide client validation using JavaScript
• Is extensible
Struts Validator
Validator is driven by two XML files, val i dat or - r ul es. xml and val i dat i ons. xml .val i dat or - r ul es. xml describes all the validation rules that can be used, such asr equi r ed, maxLengt h, i nt eger , and so on.
Each rule is defined in val i dat i ons. xml , which applies rules to the various fields in a form
bean. If validation fails, the user is redirected to the input page with the relevant error messagesfrom the validator. Note that val i dat or - r ul es. xml is extensible. You can add custom
validation rules by utilizing the appropriate classes to implement them.
Besides for server-side validation, val i dat or - r ul es. xml can also have a JavaScriptcomponent for client-side validation.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
89/256
-
13-14 Copyright © 2004, Oracle. All rights reserved.
Setting Up the Struts Validator
1. Specify the validator class in the tag of
struts-config.xml.
2. Add validation-rules.xml to your project.
3. Modify the form bean class to subclass ValidatorForm or DynaValidatorForm .
4. Create a usage file to specify form field rules.
5. Add error messages to
ApplicationResources.properties.
Setting Up the Struts Validator
Perform the steps above to set up your application workspace to utilize the Struts Validator. The
next few slides explain these steps in detail.
-
8/15/2019 Oracle JDeveloper 10g Build Applications with ADF Instructor Guide - Volume 2.pdf
90/256
-
13-15 Copyright © 2004, Oracle. All rights reserved.
Util izing the Struts Validator
Add ValidatorPlugIn to the tag and
specify the path for validator-rules.xml and
validation.xml:
Utilizing the Struts Validator
The necessary files for utilizing the Struts Validator are contained
top related