Forte   for Java  ,Internet Edition Tutorial
96 pages
English

Forte ' for Java ',Internet Edition Tutorial

-

Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres
96 pages
English
Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres

Description

Forte™ for Java™, Internet Edition Tutorial
Forte for Java, Internet Edition, 2.0
Sun Microsystems, Inc.
901 San Antonio Road
Palo Alto, CA 94303
U.S.A. 650-960-1300
Part No. 806-7515-10
December 2000, Revision A Copyright © 2000 Sun Microsystems, Inc., 901 San Antonio Road, Palo Alto, California 94303-4900, U.S.A.
All rights reserved.
This product or document is protected by copyright and distributed under licenses restricting its use,
copying, distribution, and decompilation. No part of this product or related documentation may be
reproduced in any form by any means without prior written authorization of Sun and its licensors, if any.
Third-party software, including font technology, is copyrighted and licensed from Sun suppliers. PointBase
software is for internal development purposes only and can only be commercially deployed under a separate
license from PointBase. Parts of Forte for Java, Internet Edition were developed using the public domain tool
ANTLR. This product includes software developed by the Apache Software Foundation
(http://www.apache.org/).
Sun, Sun Microsystems, the Sun logo, Java, Forte, NetBeans, Solaris, iPlanet, StarOffice, StarPortal, Jini, and
Jiro are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
Federal Acquisitions: Commercial Software—Government Users Subject to Standard License Terms and
Conditions.
Copyright © 2000 Sun Microsystems, Inc., 901 San Antonio Road, Palo Alto, California ...

Sujets

Informations

Publié par
Nombre de lectures 76
Langue English
Poids de l'ouvrage 1 Mo

Extrait

Forte™ for Java™, Internet Edition Tutorial Forte for Java, Internet Edition, 2.0 Sun Microsystems, Inc. 901 San Antonio Road Palo Alto, CA 94303 U.S.A. 650-960-1300 Part No. 806-7515-10 December 2000, Revision A Copyright © 2000 Sun Microsystems, Inc., 901 San Antonio Road, Palo Alto, California 94303-4900, U.S.A. All rights reserved. This product or document is protected by copyright and distributed under licenses restricting its use, copying, distribution, and decompilation. No part of this product or related documentation may be reproduced in any form by any means without prior written authorization of Sun and its licensors, if any. Third-party software, including font technology, is copyrighted and licensed from Sun suppliers. PointBase software is for internal development purposes only and can only be commercially deployed under a separate license from PointBase. Parts of Forte for Java, Internet Edition were developed using the public domain tool ANTLR. This product includes software developed by the Apache Software Foundation (http://www.apache.org/). Sun, Sun Microsystems, the Sun logo, Java, Forte, NetBeans, Solaris, iPlanet, StarOffice, StarPortal, Jini, and Jiro are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries. Federal Acquisitions: Commercial Software—Government Users Subject to Standard License Terms and Conditions. Copyright © 2000 Sun Microsystems, Inc., 901 San Antonio Road, Palo Alto, California 94303-4900, U.S.A. Tous droits réservés. Ce produit ou document est protégé par un copyright et distribué avec des licenses qui en restreignent l’utilisation, la copie, la distribution et la décompilation. Aucune partie de ce produit ou document ne peut être reproduite sous aucune forme, par quelque moyen que ce soit, sans l’autorisation préalable et écrite de Sun et de ses bailleurs de licence, s’il y en a. Le logiciel détenu par des tiers, et qui comprend la technologie relative aux polices de caractère, est protégé par un copyright et licencié par des fournisseurs de Sun. Le logiciel PointBase est destiné au développement interne uniquement et ne peut être mis sur le marché que sous une licence distincte émise par PointBase. Certains composants de Forte pour Java, Internet Edition ont été développés à l’aide de l’outil de domaine public ANTLR. Ce produit comprend un logiciel développé par Apache Software Foundation (http://www.apache.org/). Sun, Sun Microsystems, le logo Sun, Java, Forte, NetBeans, Solaris, iPlanet, StarOffice, StarPortal, Jini et Jiro sont des marques commerciales ou déposées de Sun Microsystems, Inc. aux Etats-Unis et dans d’autres pays. Acquisitions fédérales : logiciels commerciaux—Les utilisateurs du gouvernement sont soumis aux termes et conditions standard. Contents Preface Organization of This Manual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Forte for Java, Internet Edition Documentation Set . . . . . . . . . . . . . . . . .10 Documentation Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Online Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Javadoc . . . . . . . . . . . . . . . . . . . . . . . . 10 1 Getting Started Software Requirements for the Tutorial . . . . . . . . . . . . . . . . . . . . . . . . . .12 What You Need to Run the Forte for Java IDE . . . . . . . . . . . . . . . . . . . . . . 12 What You Need to Create and Run the Tutorial . . . . . . . . . . . . . . 12 Using Alternate Database Software . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 Using Alternate Web Browsers . . . . . . . . . . . . 13 Installing the Tutorial Database Table . . . . . . . . . . . . . . . . . . . . . . . . . . .14 Installing the Tables in a PointBase Database . . . . . . . . . . . . . . . . . . . . . 15 Installing the Table in Other Databases . . . . . . . . . . . . . . . . . . . . . . . . . . 17 Starting the Forte for Java Development Environment . . . . . . . . . . . . . . .18 Single-User and Multiuser Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 Starting Forte for Java on Solaris™ 7/8, Linux Redhat 6.2, and other UNIX™ Software . . . . . . . . . . . . . . . . . . . . 18 Starting Forte for Java on Microsoft Windows . . . . . . . . . . . . . . . . . . . . . 18 Command-Line Switches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Exiting Forte for Java . . . . . . . . 19 Forte for Java, Internet Edition Directory Structure . . . . . . . . . . . . . . . . .20 2 Introduction to the Tutorial Functionality of the Tutorial Application . . . . . . . . . . . . . . . . . . . . . . . . .24 Application Scenarios . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 Application Functional Specification . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 4 User’s View of the Tutorial Application . . . . . . . . . . . . . . . . . . . . . . . . . .26 Architecture of the Tutorial Application. . . . . . . . . . . . . . . . . . . . . . . . . .30 Application Elements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 Service Component Details . . . . . . . . . 31 Overview of Tasks for Creating the Tutorial Application . . . . . . . . . . . . . .33 Creating the Basic Application. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 Creating a Web Module . . . . . . . . . . . . . . . . . . . . . . . 33 Using Forte for Java Tag Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 Creating the Supporting Elements . . . . . . . . . . . . . . . 34 Test Running the Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 Adding Transparent Persistence. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 Creating the Persistence-Capable Classes. . . . . . . . . . 35 Saving the Order to the Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 Using the Results to Place the Order . . . . . . . . . . . . . 35 Test Running the Whole Application . . . . . . . . . . . . . . . . . . . . . . . . . . 35 End Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 3 Creating the Basic Tutorial Application Creating a Web Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .38 What Is a Web Module? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 Create the CDShopCart Web Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 Using Forte for Java Custom Tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .42 What is a JSP Tag? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 Tags (Action Elements). . . . . . . . . . . . . . . . . . . . . . . . 42 Forte for Java Tag Libraries. . . . . . . . 43 Create the CD Catalog List Page. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 Add Forte for Java Tag Libraries to the Web Module . . . . . . . . . . . . . . . 45 Create the ProductList JSP Page . . . . . . . . . . . . . . . . . 46 Declare the Tag Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 Use the JDBC connection Tag to Connect to the Database . . . . . . . . . . 47 UsDBC Query Tag to Fetch the CD Data. . . . . . . . . . . . . . . . . . . . 48 Iterate Through the Data With the Presentation Field Tag . . . . . . . . . . 49 Create the Add Button for Each CD Row . . . . . . . . . . . . . . . . . . . . . . . . 50 Clean Up With the JDBC cleanup Tag . . . . . . . . . . . . . . . . . . . . . . . . . . 51 Test Run the ProductList JSP Page . . . . . . . . . . . . . . . . . 52 Forte for Java, Internet Edition Tutorial 5 Creating the Shopping Cart Page and Supporting Elements . . . . . . . . . . .53 Create the CartLineItem JavaBeans Component . . . . . . . . . . . . . . . . . . . 54 Create the Cart JavaBeans Component . . . . . . . . . . . . . . . . . . . . 57 Create the ShopCart JSP Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 Add Code to Add or Remove an Item From the Shopping Cart Table. . . 59 Use Presentation Tags to Populate the Cart Table . . . . . . . . . . . . . . . . 61 Add the Buttons to the Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 Test Run the Shopping Cart Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 Creating the Three Message Pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . .64 Empty Cart Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 Place Order JSP Page. . . . . . . . 65 Cancel Order JSP Page. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 Test Run the Three Message Pages . . . . . . . . . .68 4 Adding Transparent Persistence to the Tutorial Application Overview of Transparent Persistence. . . . . . . . . . . . . . . . . . . . . . . . . . . .70 How You Use Transparent Persistence. . . . . . . . . . . . . . . . . . . . . . . . . . . 70 Using Transparent Persistence in the CDShopCart Application . . . . . . . . 72 Creating the Persistence-Capable Classes . . . . . . . . . . . . . . . . . . . . . . . .73 Capture the Database Schema . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 Generate the Persistence-Capable Classes. . . . . . . . . . . . . . . . . . . . . . . . 76 Enhance the Persistence-Capable Classes . . . . . . . . . . . 80 Creating the Persistence-Aware Bean . . . . . . . . . . . . . . . . . . . . . . . . . . .82 Create the CheckOutBean . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 Create the Bean and Initialize the Persistence Manager Factory and the Persistence Manager . . . . . . . . . . . . .
  • Univers Univers
  • Ebooks Ebooks
  • Livres audio Livres audio
  • Presse Presse
  • Podcasts Podcasts
  • BD BD
  • Documents Documents