Skip Headers

Oracle® Application Development Framework Case Manual 10g Release 2 (10.1.2) B19163-01 |
| Library | Product | Contents

Previous | Next |

# 3 Quick Tour of the Oracle ADF Toy Store Application

This chapter contains the following sections:

- Section 3.1, "Introduction"

- Section 3.2, "Browsing Products and Adding Them to Your Cart"

- Section 3.3, "Checking Out and Signing In"

- Section 3.4, "Registering a New User and Editing an Existing User's Profile"

- Section 3.5, "Trying Out the Toy Store Web Application in Another Language"

## 3.1 Introduction

Before examining the individual web pages and their source code in depth, you may find it helpful to become familiar with the functionality of this web store application.

## 3.2 Browsing Products and Adding Them to Your Cart

The Oracle ADF Toy Store is a realistic online store that sells toys. The products for sale are organized into five categories: accessories, games, party supplies, toys, and models. From the home page, you can browse products in the store in two ways:

- Selecting a category name to see the products in that category

  OR

- Using the What are you looking for? search box in the banner to find products by name, regardless of what category they belong to

If the list contains more than three products, products appear a page at a time. You can use the Next or Previous links above the item list to browse through the complete list.

Click on the name of a product to view a list of the different product items for sale. For example, click Piñata to see a list of the different kinds of piñatas that are available, as shown in Figure 3-1, "Browsing a Product Catalog".

Figure 3-1 Browsing a Product Catalog

On any page where the
button appears, you can click the button to add one of those items to your shopping cart.

To see a detailed description and a picture of any product, just click on its name.

You can see the items you have in your shopping cart at any time by clicking the
button, which shows a page listing the items and quantities you have selected so far, as shown in Figure 3-2, "Shopping Cart Display".

Figure 3-2 Shopping Cart Display

To adjust the quantities of the items in the cart, just type over the current value in the Quantity field and click the Update Totals button. The recalculated shopping cart total is displayed. You can remove an item from your cart either by clicking the Remove button or by adjusting the item to have a zero quantity.

## 3.3 Checking Out and Signing In

From the Shopping Cart page, click the Proceed to Checkout button to proceed to the Review Checkout page. From there, you can review your purchase and, if you are happy with it, click the Continue button to continue.

If you have not already signed into the web store site as a registered user, you will be prompted to sign in at this point to continue with the checkout process. Your sign-in page will resemble Figure 3-3, "Sign-In Page". The user named `j2ee` is already registered, with a password of `j2ee`, so you can provide these credentials to continue.

Note: If instead you want to register as a new user, click the Register as New User link. See the next section for details.

Figure 3-3 Sign-In Page

After you successfully sign in, proceed to the page where you can confirm your shipping and payment details. This part of the appliation lets you try out some of the application validation logic that has been implemented. You can try:

- Entering an invalid state abbreviation of ZA for the country USA

- Entering a credit card number that does not comprise 16 digits

and clicking the Continue button. You should see multiple validation errors, as shown in Figure 3-4, "Validation Errors on Submitted Form".

Figure 3-4 Validation Errors on Submitted Form

After fixing those errors by entering a valid state abbreviation like CA, and filling out a full 16-digit credit card number, try causing some additional validation errors by:

- Entering a date in the past for the expiration date of your credit card

- Blanking out a required field like Last Name

When you click the Continue button again, you will see the validation errors that need to be corrected, as shown in Figure 3-5, "Additional Shipping Validation Error Information".

Figure 3-5 Additional Shipping Validation Error Information

After you correct these final validation problems and resubmit your order, the order will be placed, and you'll see the final Thank You page, with an order reference number listed. Clicking on the hyperlinked order reference number takes you to an order summary page, which is implemented using the XML/XSLT-based Oracle XSQL Pages publishing framework instead of JSP pages, to illustrate that multiple view-rendering technologies are possible. (Note that this Order Summary web page is not described in this case study but is covered by the Oracle ADF Toy Store technical whitepaper.)

## 3.4 Registering a New User and Editing an Existing User's Profile

If you are not currently logged in as a registered user of the web store, you can create a new account by clicking the

button, which brings you to the Sign-In page, as shown in Figure 3-3, "Sign-In Page". From there, you can register as a new user by clicking on the Register as a New User link. This link takes you to a form where you can enter the necessary registration details.

This user registration page is another place in the application where it's easy to observe how business rules are enforced by the Oracle ADF framework. For example, if while filling out the form you:

- Enter a user name that has already been chosen by another user

- Forget to provide a password

- Enter an email address that is not properly formed

then when you submit the form, you'll see the full set of errors related to your registration, as shown in Figure 3-6, "New User Registration Validation Information".

Figure 3-6 New User Registration Validation Information

Of course, since we're working with the same underlying business object that represents user accounts here in this Update Account form, the same validation will be enforced as with the new user account. Figure 3-7, "Editing Account Details", shows the information that is to be validated when customers update their accounts.

Figure 3-7 Editing Account Details

## 3.5 Trying Out the Toy Store Web Application in Another Language

The application is built using the internationalization features supported by Struts and Oracle ADF Business Components, and it ships with support for three languages: English (the default), Italian, and German. The Struts and Oracle ADF frameworks determine the language to be displayed, based on your browser settings. You can see what the web pages look like in Italian by setting your browser language preferences appropriately.

In `Mozilla Firefox 0.9`, you select your preferred languages on the General page of the Tools > Options menu by clicking the Languages button, as shown in Figure 3-8, "Setting Preferred Languages in Mozilla Firefox". You can add Italian [it] and then click Move Up to move it to the top of the list.

Figure 3-8 Setting Preferred Languages in Mozilla Firefox

In Internet Explorer, you can do the same thing by choosing Tools > Internet Options and by clicking on the Languages button in the General page of the dialog.

Since Apache Struts caches the browser user's preferred language at the servlet session level, you will need to close the current browser window and open a new one before you'll see the application change to Italian. A quick way to relaunch your preferred browser with the right URL for the application is to find and click the target URL in the JDeveloper 10g Log window, as shown in Figure 3-9, "Relaunching the Browser Window".

Figure 3-9 Relaunching the Browser Window

Clicking on the Log URL will start the Oracle ADF Toy Store application again, but this time in Italian. After you add the same items to your shopping cart, your page will resemble what you see in Figure 3-10, "The Shopping Cart Home Page in Italian".

Figure 3-10 The Shopping Cart Home Page in Italian

You can set your browser's preferred language back to English, and close and relaunch the browser window to proceed in English again.

The next chapter begins the first lesson of the case study, where you will investigate designing databound JSP pages in JDeveloper.