Você está na página 1de 3

ADF Validation

After adding the objects, right click on an entity object. The entity object
Editor: will display the Name, Attributes, Tuning, Java, Validation and etc.
Double click on the Validation rule. A box will appear as shown below in
Figure1. In the Rules drop-down list, there are four kinds of validators:

• CompareValidator: This allows you to define the value to which the


attribute value should be compared. It also gives you the option to
compare with query results or view object attributes.
• ListValidator: This allows you to compare the value with a list of
values either specified or returned by a SQL query or provided as a
view object attribute.
• RangeValidator: This allows you the range that the attribute should
be in.
• MethodValidator: This allows you to define the method that will do
the validation.

In this tutorial, we will be using the RangeValidator.

1. Select the RangeValidator. When you do, the application will automatically
default the Attribute: the object you are editing and the Operator will default to
between.
2. In this case, I set the Minimum Value to 10 and the Maximum Value to 1000.

Figure 1.

1
3. After setting Minimum and Maximum value. Hit OK. A window will display the
following in figure2.

Figure 2.

4. Now, Connect to the database with


oracle:thin@oracle.cis.ksu.edu:1521:ORACLE, by right-clicking on the
AppModule. See Figure 3

Figure 3.

2
5. Once the connection has been successful to the database. Figure4 will be
displayed. It is the running application.

Figure 4.

6. Now, we can test the validation between 10 – 1000. I entered a 9 and received the
following error, which is correct. See Figure 5.
Again, when a value is between the validation that is specified, No error message
will display.

Figure 5.

Joanna Gonzales, Fall 2004