XML, XSLT, Java, and JSP: A Case Study in Developing a Web Application docx

768 431 0
XML, XSLT, Java, and JSP: A Case Study in Developing a Web Application docx

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

XML, XSLT, Java  , and JSP  : A Case Study in Developing a Web Application Contents At a Glance 1 Introduction and Requirements 2 An Environment for Java Software Development 3 Java Servlets and JavaServer Pages: Jakarta Tomcat 4 XML and XSLT: Xerces and Xalan 5 bonForum Chat Application: Use and Design 6 bonForum Chat Application: Implementation 7 JavaServer Pages:The Browseable User Interface 8 Java Servlet and Java Bean: BonForumEngine and BonForumStore 9 Java Applet Plugged In: BonForumRobot 10 JSP Taglib:The bonForum Custom Tags 11 XML Data Storage Class: ForestHashtable 12 Online Information Sources A CDROM Contents B Some Copyrights and Licenses C Source Code for bonForum Web Application D Sun Microsystems, Inc. Binary Code License Agreement 00 1089-9 FM 6/26/01 8:20 AM Page i 00 1089-9 FM 6/26/01 8:20 AM Page ii XML, XSLT, Java  , and JSP  : A Case Study in Developing a Web Application 201 West 103rd Street, Indianapolis, Indiana 46290 An Imprint of Pearson Education Boston • Indianapolis • London • Munich • New York • San Francisco Westy Rockwell www.newriders.com 00 1089-9 FM 6/26/01 8:20 AM Page iii Publisher David Dwyer Associate Publisher Al Valvano Executive Editor Stephanie Wall Managing Editor Gina Brown Product Marketing Manager Stephanie Layton Publicity Manager Susan Nixon Software Development Specialist Jay Payne Project Editor Elise Walter Copy Editor Krista Hansing Indexer Larry Sweazy Manufacturing Coordinator Jim Conway Book Designer Louisa Klucznik Cover Designer Aren Howell Proofreader Jeannie Smith Composition Gina Rexrode XML, XSLT, Java  , and JSP  : A Case Study in Developing a Web Application Translation from the German language edition of: XML, XSLT, Java, and JSP by Westy Rockwell  2000 Galileo Press GmbH Bonn, Germany FIRST EDITION: July 2001 All rights reserved. No part of this book may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying or recording, or by any information storage and retrieval system, without written permission from the publisher, except for the inclusion of brief quotations in a review. International Standard Book Number: 0-7357-1089-9 Library of Congress Catalog Card Number: 00-110885 05 04 03 02 01 7 6 5 4 3 2 1 Interpretation of the printing code:The rightmost double- digit number is the year of the book’s printing; the right- most single-digit number is the number of the book’s printing. For example, the printing code 01-1 shows that the first printing of the book occurred in 2001. Composed in Bembo and MCPdigital by New Riders Publishing Printed in the United States of America Trademarks All terms mentioned in this book that are known to be trademarks or service marks have been appropriately capital- ized. New Riders Publishing cannot attest to the accuracy of this information. Use of a term in this book should not be regarded as affecting the validity of any trademark or service mark. Java and JavaServer Pages (JSP) are registered trade- marks of Sun Microsystems, Inc. Warning and Disclaimer This book is designed to provide information about XML, XSLT, Java, and JSP. Every effort has been made to make this book as complete and as accurate as possible, but no war- ranty or fitness is implied. The information is provided on an as-is basis.The authors and New Riders Publishing shall have neither liability nor responsibility to any person or entity with respect to any loss or damages arising from the information contained in this book or from the use of the discs or programs that may accompany it. 00 1089-9 FM 6/26/01 8:20 AM Page iv ❖ THIS BOOK IS DEDICATED TO MEMORIES OF YOU, DON ROCKWELL, SR. YOU GAVE SO MUCH TO ME! DID I EVER SAY ENOUGH, SOMEHOW, FOR YOU TO KNOW HOW MUCH I LOVE YOU? WITHOUT YOUR LOVE AND KIND GENEROSITY, I WOULD NOT FEEL HALF SO FORTUNATE TO BE ALIVE TODAY. BESIDES THAT, YOU TAUGHT ME TO ENJOY THIS LIFE, SWIM IN THE BLUE OCEANS,AND DIVE DOWN SO DEEPLY. I WOULD MISS YOU FOREVER, IF I WERE NOT SO SURE THAT YOU ARE HERE. THANK YOU! W. R . ❖ 00 1089-9 FM 6/26/01 8:20 AM Page v TABLE OF CONTENTS 1 Introduction and Requirements 1 1.1 The Goal of This Book 1 1.2 Why Use This Book? 2 1.3 How to Use This Book 4 1.4 Some Choices Facing Web Application Developers 6 1.5 Development Choices Made for This Book 8 1.6 A Note About Platform Independence 14 2 An Environment for Java Software Development 15 2.1 Java 2 Platform, Standard Edition 15 2.2 Compiling Java Programs 19 2.3 Running Java Programs 30 2.4 Debugging Java Programs 32 2.5 Other Features of ElixirIDE 33 3 Java Servlets and JavaServer Pages: Jakarta Tomcat 35 3.1 Apache Software Foundation 35 3.2 Jakarta Tomcat 36 3.3 Installing Tomcat 37 3.4 Running Tomcat 39 00 1089-9 FM 6/26/01 8:21 AM Page vi 3.5 Tomcat Examples of Servlets and JSPs 49 3.6 Adding Your Tomcat Web Application 49 3.7 Java Servlets and JSPs 53 3.8 The ServletConfig and ServletContext Classes 57 3.9 Web Application Scopes 58 4 XML and XSLT: Xerces and Xalan 61 4.1 Apache XML Project 61 4.2 Installing Xerces 62 4.3 Xerces Parses XML 64 4.4 SAX Sees XML as Events 67 4.5 Installing Xalan 67 4.6 Xalan Transforms XML Using XSLT 70 4.7 Using Beanshell with Xalan 72 4.8 Using Xalan from the Command Line 73 4.9 Zvon XSL Tutorial 73 4.10 Xerces and Xalan versus XT and XP 73 4.11 JSP and XML Synergy 74 5 bonForum Chat Application: Use and Design 77 5.1 Installing and Running bonForum 77 5.2 Changing the bonForum Web Application 83 5.3 Using XML to Design Web Applications 86 5.4 XML Data Flows in Web Applications 98 vii Contents 00 1089-9 FM 6/26/01 8:21 AM Page vii 6 bonForum Chat Application: Implementation 103 6.1 Building the bonForum Web Chat 103 6.2 Displaying and Selecting Chat Subjects 138 6.3 Displaying Chat Messages 140 6.4 Finding the Chat Element 146 6.5 Displaying and Selecting Chats 148 6.6 Displaying Guests in Chat 150 6.7 Outputting the bonForum Data as XML 150 6.8 Future of bonForum Project 151 7 JavaServer Pages: The Browseable User Interface 155 7.1 JSP-Based Web Applications 155 7.2 Viewing bonForum from Its JSP Documents 163 7.3 Further Discussion About the JSP in bonForum 187 8 Java Servlet and Java Bean: BonForumEngine and BonForumStore 189 8.1 The BonForumEngine Servlet 189 8.2 The BonForumStore Class 262 9 Java Applet Plugged In: BonForumRobot 285 9.1 Hands-on with Java Applets 285 9.2 XSLTProcessor Applet 290 9.3 BonForumRobot 290 viii Contents 00 1089-9 FM 6/26/01 8:21 AM Page viii 10 JSP Taglib: The bonForum Custom Tags 303 10.1 Java Servlets, JSP, and Tag Libraries 303 10.2 The bonForum Tag Library 316 10.3 The OutputDebugInfoTag Class 324 10.4 The OutputPathNamesTag Class 331 10.5 The OutputChatMessagesTag Class 340 10.6 XSLT and the TransformTag Class 352 10.7 Displaying the Available Chats 371 10.8 Displaying the Available bonForums 376 10.9 Displaying the Guests in a Chat 379 11 XML Data Storage Class: ForestHashtable 385 11.1 Overview of bonForum Data Storage 385 11.2 The NodeKey Class 387 11.3 The BonNode Class 388 11.4 ForestHashtable Maps Data Trees 390 11.5 Caching Keys for Fast Node Access 398 11.6 Adding ForestHashtable Nodes 404 11.7 Deleting ForestHashtable Nodes 411 11.8 Editing ForestHashtable Nodes 414 11.9 Getting ForestHashtable as XML 416 ix Contents 00 1089-9 FM 6/26/01 8:21 AM Page ix 11.10 More Public ForestHashtable Methods 424 11.11 Initializing the bonForumXML Database 427 11.12 Runtime bonForumXML Database 429 11.13 More ForestHashtable Considerations 432 12 Online Information Sources 437 12.1 Always Useful Sites 437 12.2 Apache Software Foundation 438 12.3 Big Corporations 438 12.4 CSS 439 12.5 DOM Information 439 12.6 HTML 439 12.7 HTTP 439 12.8 Java 440 12.9 JavaServer Pages 441 12.10 Java Servlets 443 12.11 Linux 445 12.12 Open Source 445 12.13 RDF 446 12.14 Web Applications 446 12.15 Web Browsers 446 12.16 Web Servers 446 12.17 XML 447 12.18 XSL 452 A CD-ROM Contents 455 \Sun 456 \Apache 456 \bonForum 456 \tools 458 E-Book 458 x Contents 00 1089-9 FM 6/26/01 8:21 AM Page x [...]... Java development environment It shows you how to compile, debug and run the Web application example project Chapter 3, “Java Servlets and JavaServer Pages: Jakarta Tomcat,” introduces Tomcat, which is an HTTP server and a container for Java Servlets and JavaServer Pages Chapter 4, “XML and XSLT: Xerces and Xalan,” introduces Xerces, a DOM and a SAX parser, and Xalan, an XSLT and XPATH processor Chapter... machine! A Web application that can change, adapt, and evolve by changing only the software on a few server machines is far easier to deploy, maintain, and support than is a Web application made up of programs that must be installed and configured on thousands of client machines We stated above “emphasizing the server side” because the most practical approach seems to be to allow for both server-side and. .. 14 Chapter 1 Introduction and Requirements available for Windows, Linux, Solaris, and others It can be run with IIS, Apache, Netscape, and other servers.You can find out about JRun at the Allaire Web site, at http://www.allaire.com/Products/JRun/ Many Web- application framework products also understand servlets and JSP Prominent among these are Netscape Application Server and iPlanet, Oracle Application. .. reader That is when the fun started I designed and implemented a Web chat application called bonForum It is based on XML and XSLT, Java servlets and applets, and JSP It presented me with many of the most challenging tasks of Web application design As a very popular and timely type of Web application, I trust that it will interest the reader As an experiment and a tutorial, its design and implementation... A Case Study in Developing a Web Application As the book was being written, these dedicated professionals reviewed all the material for technical content, organization, and flow.Their feedback was critical to ensuring that XML, XSLT, Java, and JSP: A Case Study in Developing a Web Application fits our reader’s need for the highest-quality technical information Brad Irby holds a bachelor of computer science... popular open-source product, called Tomcat, to enable the serving of Java servlets and JavaServer Pages Tomcat is being developed by the Jakarta Project Like the Apache XML Project that develops Xalan and Xerces, the Jakarta Project is part of the Apache Software Foundation.You can find out more about the Jakarta Project and all its various products at http://jakarta.apache.org The intention of the Jakarta... processing, depending upon what needs to be done Java developers can take advantage of Java applets, which enable you to use client-side processing in a Web application while avoiding some of the software distribution problems.The Java plug -in provides a way to run Java applets transparently on differing Web browsers According to James Gosling, the creator of Java, the closer integration of the plug -in and. .. compiled into Java servlets before they are useful.The standard way for you to distribute a Web application is as a Web archive (WAR file), and you commonly assume that the recipient of a WAR file has a Web server, together with a container (such as Tomcat) that can compile JSP pages and a suitable compiler for the container to use Providing the compiler is not usually your concern as a Web application. .. we have assumed that you, its reader, are a software developer with some Java experience and that you want to build Web applications based on XML, XSLT, Java servlets, Java applets, and JavaServer Pages.The goal of this book is to support you as you learn about using all of these increasingly important technologies together.This book will help you become familiar with a set of widely available and. .. likely a dead language because it is one that is no longer evolving As a developer who wants to create server-based Web applications, you have a wide choice of languages and tools to use Some important languages are Java, C++,Visual Basic, Perl, and Python Of course, HTML (especially now as XHTML) is crucial for controlling browser content XML and its related languages are becoming increasingly important, . for Java Servlets and JavaServer Pages. Chapter 4,“XML and XSLT: Xerces and Xalan,” introduces Xerces, a DOM and a SAX parser, and Xalan, an XSLT and XPATH. material for technical content, organization, and flow.Their feedback was critical to ensuring that XML, XSLT, Java, and JSP: A Case Study in Developing a Web Application

Ngày đăng: 05/03/2014, 23:20

Từ khóa liên quan

Tài liệu cùng người dùng

Tài liệu liên quan