Apple WebObjects 3.5 Manuel d'utilisateur Page 1

Naviguer en ligne ou télécharger Manuel d'utilisateur pour Logiciel Apple WebObjects 3.5. Apple WebObjects 3.5 User Manual Manuel d'utilisatio

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 120
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs

Résumé du contenu

Page 1 - WITH WEBOBJECTS

GETTING STARTED WITH WEBOBJECTS

Page 2

Preface 10 Where to Go From Here After you have worked through the tutorials in this book, you should have a good working knowledge of WebObjects. Fo

Page 3 - Contents

Chapter 3 Creating a WebObjects Database Application100your relationship, and the relationship’s name is dependent on the adaptor the wizard used. Ada

Page 4

Refining Your Model1018. Click Connect.EOModeler automatically renames the relationship based on the name of the destination entity. For example, after

Page 5 - Table of Contents

Chapter 3 Creating a WebObjects Database Application102At this point your model has all the relationships it needs. The Diagram View gives you an over

Page 6 - Refining Your Model 97

Refining Your Model1033. Ensure that the delete rule is set to Cascade.If the wizard created relationships for you, the relationship’s delete rule shou

Page 7

Chapter 3 Creating a WebObjects Database Application104Enterprise Objects Framework provides several mechanisms for generating and assigning unique va

Page 8

Setting Up a Master-Detail Configuration105In the Movies application, the master-detail configuration is built around Movie’s movieRoles relationship. T

Page 9 - About This Book

Chapter 3 Creating a WebObjects Database Application106An Add Display Group panel opens.3. In the Add Display Group panel, change the name to movieRol

Page 10 - Where to Go From Here

Setting Up a Master-Detail Configuration107Notice that the “Has detail data source” box is checked. This means that movieRoleDisplayGroup gets its obje

Page 11 - Chapter 1

Chapter 3 Creating a WebObjects Database Application1086. Check the “Fetches on load” box.When “Fetches on load” is selected, the display group fetche

Page 12

Setting Up a Master-Detail Configuration1091. In the MovieDetails component window, add the bolded text Starring: beneath the Revenue line.2. Below the

Page 13

Creating a Simple WebObjects Application Chapter 1

Page 14 - Set project type here

Chapter 3 Creating a WebObjects Database Application110When you’re done, the repetition bindings should look like the following:Running MoviesBe sure

Page 15 - GuestBook

Updating Objects in the Detail Display Group111Updating Objects in the Detail Display GroupIn this section, you’ll add the ability to insert, update,

Page 16

Chapter 3 Creating a WebObjects Database Application112Managing a DisplayGroup’s SelectionRemember how clicking a movie title in the Main page selects

Page 17 - Examining Your Project

Updating Objects in the Detail Display Group113Adding a FormNow lay out the user interface used to view and edit the selected MovieRole. When you’re d

Page 18 - Launching WebObjects Builder

Chapter 3 Creating a WebObjects Database Application1142. Using the Display Group Options panel, assign talentDisplayGroup’s entity to Talent.Remember

Page 19

Updating Objects in the Detail Display Group115Talent browser, the selection should refer to a single object. Consequently, you need to add two method

Page 20 - Creating the Page’s Content

Chapter 3 Creating a WebObjects Database Application116Again because the browser uses a vector for its selections attribute, the setTalentSelection me

Page 21 - Entering Static Text

Adding Behavior to Your Enterprise Objects1176. Copy the saveChanges method from the Main.java class and paste it into the MovieDetails.java class:pub

Page 22 - Using the Inspector

Chapter 3 Creating a WebObjects Database Application1181. In EOModeler, inspect the Talent entity.2. In the Entity Inspector for Talent, type Talent i

Page 23

Adding Behavior to Your Enterprise Objects119Adding Custom Behavior to TalentNow add the fullName method to Talent and bind it to the browser.1. Open

Page 25 - Resizing the Form Elements

Chapter 3 Creating a WebObjects Database Application120Running MoviesBe sure that all your project’s files are saved (including your model file), and bu

Page 26 - Enter rows and columns here

13 This chapter introduces you to the basic concepts and procedures of developing WebObjects applications. You’ll develop, in stages, a simple applic

Page 27 - Binding Elements

Chapter 1 Creating a Simple WebObjects Application 14 Project Builder is an integrated software-development application. It contains a project browse

Page 28 - String directly in the box

Creating a WebObjects Application Project 15 4. Click Browse.5. In the Save panel, navigate to the DocumentRoot /WebObjects directory. DocumentRoot

Page 29 - Binding the Input Elements

Chapter 1 Creating a Simple WebObjects Application 16 9. For Available Assistance, choose None.If you are developing an application that accesses a d

Page 30 - Implementing an Action Method

Examining Your Project 17 Examining Your Project Project Builder displays a browser showing the contents of your project. The first column lists sever

Page 31

Chapter 1 Creating a Simple WebObjects Application 18 3. Select Classes in the first column of the browser. You’ll see three files listed in the second

Page 32 - action method

Launching WebObjects Builder 19 2. Double-click Main.wo in the second column.The application WebObjects Builder launches and displays a window enti

Page 33 - <HR> element)

Apple, NeXT, and the publishers have tried to make the information contained in this manual as accurate and reliable as possible, but assume no respo

Page 34 - View Source File

Chapter 1 Creating a Simple WebObjects Application 20 This pop-up list allows you to switch between graphical editing mode and source editing mode. W

Page 35 - Click here to build

Creating the Page’s Content 21 • Structures . Use these buttons to create paragraphs, lists, images, and other static HTML elements. This setting is

Page 36

Chapter 1 Creating a Simple WebObjects Application 22 Using the Inspector You use the Inspector window to set properties of the elements in your comp

Page 37 - Enhancing Your Application

Creating the Page’s Content23Each element has its own Inspector that allows you to set properties appropriate for the element. The Page Attributes Ins

Page 38

Chapter 1 Creating a Simple WebObjects Application241. To display the dynamic form elements buttons in the toolbar, choose from the Elements pop-up

Page 39 - Duplicating Your Project

Creating the Page’s Content25The window should now look like this:Resizing the Form ElementsThe text fields and text area are a bit small, so you’ll re

Page 40 - PB.project.)

Chapter 1 Creating a Simple WebObjects Application261. Inspect the Name text field (that is, select the text field and open the Inspector window). 2. Ch

Page 41 - Creating a Custom Guest Class

Binding Elements275. Inspect the multi-line text area. In Text Area Inspector, you can set various attributes corresponding to those of a <TEXTAREA

Page 42

Chapter 1 Creating a Simple WebObjects Application28WebObjects Builder allows you to declare variables without having to edit your source file directly

Page 43

Binding Elements29Binding the Input ElementsEach dynamic element contains several attributes. These attributes determine what happens when the element

Page 44

Contents

Page 45

Chapter 1 Creating a Simple WebObjects Application30The Inspector window comes to the front, displaying the bindings for the text area. The value attr

Page 46 - Creating the Guest Object

Binding Elements313. From the “Page returned” pop-up menu, select null.The value returned by an action method represents the next page (component) to

Page 47 - Main.java

Chapter 1 Creating a Simple WebObjects Application32Creating the Application’s OutputSo far, you have a way for the guest to enter information and a w

Page 48 - Creating a Guest List

Creating the Application’s Output332. Choose from the Elements pop-up list to display the Structures buttons.3. Click to create a horizontal line

Page 49 - Application, which is

Chapter 1 Creating a Simple WebObjects Application3410. Save your component. It should now look like this:In summary, when the user clicks the Submit

Page 50

Building and Running Your Application35Building and Running Your Application1. Make Project Builder active. A quick way to do this from WebObjects Bui

Page 51 - Adding a Second Component

Chapter 1 Creating a Simple WebObjects Application366. Click in the Launch panel to launch your application.The Launch Panel displays a series of me

Page 52 - WOString

Enhancing Your ApplicationChapter 2

Page 54 - Guest as its type

Duplicating Your Project39In the previous tutorial, you learned how to create a web component that has input and output elements and how to bind these

Page 56 - Adding the Finishing Touches

Chapter 2 Enhancing Your Application404. Duplicate the GuestBook folder.On Windows NT, you can do this by selecting the folder, choosing Edit m Copy,

Page 57 - Adding a Dynamic Hyperlink

Creating a Custom Guest Class41Creating a Custom Guest ClassIn the first chapter, you created individual variables to store a guest’s name, e-mail addr

Page 58 - Main”, because you

Chapter 2 Enhancing Your Application42also a class, specifically a subclass of the class next.wo.Component (called WOComponent in WebScript or Objectiv

Page 59 - Database Application

Creating a Custom Guest Class436. Double-click the row containing the value binding.This removes the binding for guestName you made previously and bin

Page 60

Chapter 2 Enhancing Your Application446. Double-click the upper-left cell.You can now edit the contents of the cell. If you want to resume structure e

Page 61

Creating a Custom Guest Class4511. Click in the component window, then press Tab.Pressing Tab when editing a table causes the contents of the next cel

Page 62 - The Movies Application

Chapter 2 Enhancing Your Application46The table should now look like this:3. Save the Main component.Creating the Guest ObjectEarlier in this chapter,

Page 63

Keeping Track of Multiple Guests474. Save Main.java.5. Build and run your application.The application should work similarly to the first chapter, excep

Page 64

Chapter 2 Enhancing Your Application48Before doing this, it is important to understand the scope and life span of variables in WebObjects:• Component

Page 65 - Designing the Main Page

Keeping Track of Multiple Guests49Note that there is one method already defined: Application, which is the constructor for the application object. The

Page 66 - Specifying a Model File

v Table of Contents Contents iiiPreface 7 About WebObjects 9About This Book 9Where to Go From Here 10 Creating a Simple WebObjects Application 11 Cre

Page 67 - Choosing an Adaptor

Chapter 2 Enhancing Your Application503. At the top of the Application class definition, enter this declaration:protected MutableVector allGuests;This

Page 68

Adding a Second Component51Adding a Second ComponentIn this section, you’ll create a new component. Instead of Java, you’ll implement its code using W

Page 69

Chapter 2 Enhancing Your Application5210. In the object browser, click application. There is an entry in the second column for the allGuests applicati

Page 70

Using a Repetition53pageWithName is a standard WebObjects method (defined in the WebApplication class) that allows you to specify a new page to display

Page 71 - Specifying Primary Keys

Chapter 2 Enhancing Your Application54You’ll bind the allGuests array to the WORepetition’s list attribute. This tells WebObjects to generate the elem

Page 72 - Shift-click to select more

Using a Repetition5511. In the object browser, select application in the first column.12. In the second column, click allGuests and drag the cursor to

Page 73

Chapter 2 Enhancing Your Application56By using the name currentGuest for the item attribute, you are taking advantage of the fact that the strings in

Page 74 - Choosing an Entity

Adding the Finishing Touches574. Enter the following code before the return statement in clearGuestList:[[self application] clearGuests];This code cal

Page 75 - Choosing a Layout

Chapter 2 Enhancing Your Application585. Select the pageName attribute, then double-click in the Binding column and type (including the quotes) "

Page 76

Creating a WebObjectsDatabase ApplicationChapter 3

Page 77

vi Adding the MovieDetails Page 92 Creating the MovieDetails Component 93Storing the Selected Movie 93Navigating from Main to MovieDetails 94Designin

Page 79

61One of the most powerful features of WebObjects is its ability to provide access to databases. To do so, it uses a framework called the Enterprise O

Page 80 - Examining the Variables

Chapter 3 Creating a WebObjects Database Application62The Movies ApplicationThe Movies application has two pages, each of which allows you to access i

Page 81 - Examining the Bindings

The Movies Application63Enterprise Objects and the Movies DatabaseEnterprise Objects Framework manages the interaction between the database and object

Page 82 - Bindings in the Query Part

Chapter 3 Creating a WebObjects Database Application64MOVIE_ROLE table having a MOVIE_ID column. In the MOVIE table, MOVIE_ID is a primary key, while

Page 83 - Bindings in the Editing Part

Designing the Main Page65Designing the Main PageEvery WebObjects application has at least one component—usually named Main—that represents the first pa

Page 84

Chapter 3 Creating a WebObjects Database Application665. Type Movies in the “File name” field.6. Click Save.7. In the New Project panel, click OK.This

Page 85 - Refining Main.wo

Designing the Main Page67Choosing an AdaptorAn adaptor is a mechanism that connects your application to a particular database server. For each type of

Page 86 - Specifying a Sort Order

Chapter 3 Creating a WebObjects Database Application683. Complete the login panel.Specify the connection information you provided when you created and

Page 87

Designing the Main Page69A relationship is a link between two entities that’s based on attributes of the entities. For example, the Movie entity has a

Page 89 - Setting a Number Format

Chapter 3 Creating a WebObjects Database Application703. Uncheck the “Ask about stored procedures” box.Checking this box causes the wizard to read sto

Page 90 - Optional Exercise

Designing the Main Page71Choosing the Tables to Include1. In the wizard panel, select MOVIE, MOVIE_ROLE, and TALENT in the Tables browser.The wizard c

Page 91

Chapter 3 Creating a WebObjects Database Application721. Select movieId as the primary key for the Movie entity.2. Click Next.3. Select both movieId a

Page 92 - Adding the MovieDetails Page

Designing the Main Page73If foreign key definitions aren’t specified in your database server’s schema information (as with Microsoft Access), the wizard

Page 93 - Storing the Selected Movie

Chapter 3 Creating a WebObjects Database Application742. Choose Cascade.This option specifies what to do when the source object (the Movie) is deleted.

Page 94 - Add the hyperlink below

Designing the Main Page75Choosing a LayoutThe wizard provides several page layout options for formatting objects fetched from the database.1. Choose S

Page 95 - Movie Details

Chapter 3 Creating a WebObjects Database Application76There are three parts to this page: the query part (at the top of the page), which contains field

Page 96 - MovieSearch

Designing the Main Page77The order in which you add the attributes determines the order in which they appear on the page, so add them in the following

Page 97 - Refining Your Model

Chapter 3 Creating a WebObjects Database Application78When the wizard finishes, your new project is displayed in Project Builder. The wizard has produc

Page 98

Examining Your Project79Examining Your ProjectWhenever you create a new project, Project Builder populates the project with ready-made files and direct

Page 100

Chapter 3 Creating a WebObjects Database Application80Examining the Variables1. Double-click Main.wo in Project Builder’s WebObjects Components catego

Page 101 - Switches to Browser View

Examining Your Project81Also note the comment explaining how movieDisplayGroup is initialized. The Main.java class doesn’t have any code to create and

Page 102 - This box should be checked

Chapter 3 Creating a WebObjects Database Application82Bindings in the Query PartIn the query part of the component, movieDisplayGroup.queryMatch.title

Page 103

Examining Your Project831. Inspect the hyperlink.Its action attribute is bound to the action method selectObject.2. Look in the Main.java class to see

Page 104

Chapter 3 Creating a WebObjects Database Application841. Inspect the middle image button.Its action attribute is bound to the action method saveChange

Page 105

Refining Main.wo85group’s selected object. These changes happen only in memory—not in the database. To actually insert a new row in the database (or de

Page 106 - WebObjects Builder assigns

Chapter 3 Creating a WebObjects Database Application86Specifying a Sort OrderYou can change your application to sort movies alphabetically without wri

Page 107

Refining Main.wo87Specifying Default Values for New Enterprise ObjectsWhen new enterprise objects are created in your application, it’s common to assig

Page 108 - Adding a Repetition

Chapter 3 Creating a WebObjects Database Application88The Movies application specifies default values for newly created Movie objects using the display

Page 109 - Configuring a Repetition

Refining Main.wo89Setting a Number FormatIn addition to a dateformat attribute, text field elements also have a numberformat attribute.1. Inspect the re

Page 110 - Running Movies

9 About WebObjects WebObjects is an object-oriented environment for developing and deploying World Wide Web applications. A WebObjects application ru

Page 111

Chapter 3 Creating a WebObjects Database Application90Optional ExerciseYou can tidy up the user interface even further by putting the query part of th

Page 112 - return null;

Refining Main.wo914. In the Table Inspector, choose Unspecified for the table width.The table resizes to just fit its contents. When you change the cell

Page 113 - Adding a Talent Display Group

Chapter 3 Creating a WebObjects Database Application92Adding the MovieDetails PageThe MovieDetails page shows you the detailed information about a mov

Page 114 - Configuring the Browser

Adding the MovieDetails Page93Creating the MovieDetails Component1. In Project Builder, choose File m New in Project.2. In the New File panel, click t

Page 115

Chapter 3 Creating a WebObjects Database Application94Movie isn’t actually a class; it’s an entity. It’s listed in the combo box as a type along with

Page 116 - Add the image buttons inside

Adding the MovieDetails Page958. In Project Builder, modify the showDetails action to look like the following: public Component showDetails(){ Movi

Page 117

Chapter 3 Creating a WebObjects Database Application96This adds a new level 3 heading element around the string. The MovieDetails page will show the t

Page 118 - Talent in the Class field

Refining Your Model97telling the application to open the MovieSearch page when the hyperlink is clicked.Running MoviesBe sure that all your project’s fi

Page 119

Chapter 3 Creating a WebObjects Database Application98Project Builder opens your model file in EOModeler, launching EOModeler first if it isn’t already

Page 120

Refining Your Model994. In the MovieRole entity, remove movieId and talentId as class properties.5. In the Talent entity, remove talentId as a class pr

Commentaires sur ces manuels

Pas de commentaire