Sun Logo


Sun ONE Application Framework Tutorial

Suntrademark ONE Studio 5 update 1

817-4358-10



Contents

Preface

How This Book Is Organized

Using UNIX Commands

Related Documentation

Accessing Sun Documentation

Contacting Sun Technical Support

Sun Welcomes Your Comments

1. Before You Begin

Primary Features of the Sun ONE Application Framework

QA Certification

2. Getting Started

Introduction

Writing Sun ONE Application Framework Applications

J2EE/Sun ONE Application Framework Terminology

How Sun ONE Application Framework Applications Are Organized

About the Sun ONE Application Framework Tutorial

3. Tutorial Sections (Links to)

Sections 1.1--1.3

Sections 2.1--2.6

Sections 3.1--3.3

Sections 4.1--4.5

4. Tutorial--Section 1.1 Application Infrastructure

Task 1: New Sun ONE Web Application

Create an Application Wizard

Application Servlet

Module Servlet

Advanced Tip - Modules

5. Tutorial--Section 1.2 Create Login Page

Task 2: Create the Login Page

Add a ViewBean

Add Display Fields to the Login Page

Add Code to the Login Button

6. Tutorial--Section 1.3 Test Run the Login Page

Task 3: Test Run the Login Page

Compile the Web Application

Test Run the Login Page

Test a Successful Login

Test an Unsuccessful Login

Alternative Runtime Environments

7. Tutorial--Section 2.1 Prepare Application to Access SQL Database

Task 1: Accessing a SQL Database

Connect to the Sample Database

JDBC Datasources

Tomcat (and other non-JNDI containers) SQL Connection Preparation

8. Tutorial--Section 2.2 Create the CustomerModel

Task 2: Create the CustomerMode

Create a JDBCtrademark SQL Model

Mark the Model's Key Field(s)

Add Connection Code for Non-JNDI Enabled Containers

9. Tutorial--Section 2.3 Create Customer Page

Task 3: Create the Customer Page

Add a ViewBean

Add a Button Component

Making a Model Auto Update

Add a Hidden Field to the Customer Page

Format the JSP

10. Tutorial--Section 2.4 Test Run the Customer Page

Task 4: Test Run the Customer Page

Test a Customer Update

11. Tutorial--Section 2.5 Link Login Page to Customer Page

Task 5: Link the Login Page to the Customer Page

Edit the handleLoginRequest Method in LoginPage

12. Tutorial--Section 2.6 Run Application

Task 6: Run the Application

13. Tutorial--Section 3.1 Create a Command Component

Task 1: Create a Command Component

Create the UserAccessCommand Component

Add Code to the execute Method

Configure a Button's Command Descriptor

14. Tutorial--Section 3.2 Add a Logout Link to the Customer Page

Task 2: Add an HREF to a Customer Page

Configure an HREF's Command Descriptor

Format the HREF tag in the Customer JSP

15. Tutorial--Section 3.3 Test Run the Login/Logout Command Component

Task 3: Test Run the Login/Logout Command

16. Tutorial--Section 4.1 Prepare to Create a Web Service Model

Task 1: Web Service User Registration and Downloading

Download the Web Service SDK

Register to Use the Web Service

Create the Web Service Model

17. Tutorial--Section 4.2 Create the Google Search Page

Task 2: Create the Google Search Page

Add a Page Component

Add More Visual Components to the Page

Enable the Search Button

Manual Code Technique

Point & Click Technique (code-free)

Format the JSP Content

18. Tutorial--Section 4.3 Test Run the Google Search Page

Task 3: Test Run the Google Search Page

Try a Search

19. Tutorial--Section 4.4 Add Results Listing to the Google Search Page

Task 4: Create a TiledView Pagelet

Add a TiledView

Configure the TiledView Pagelet Component

Getting the Correct Primary Model Dataset Name

Add the Pagelet to a Page

Formatting the JSP

20. Tutorial--Section 4.5 Test Run the Google Search Page

Task 5: Test Run the Google Search Page with Results

Try a Search