1. Trang chủ
  2. » Khoa Học Tự Nhiên

OReilly programming jakarta struts 2nd edition

999 74 0

Đ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

Thông tin cơ bản

Định dạng
Số trang 999
Dung lượng 5,21 MB

Nội dung

• • • • • • Table of Contents Index Reviews Reader Reviews Errata Academic Programming Jakarta Struts, 2nd Edition By Chuck Cavaness Publisher : O'Reilly Pub Date : June 2004 ISBN : 0-596-00651-9 Pages : 470 If you want to use the Struts Framework to its fullest potential, this is the book for you Programming Jakarta Struts, 2nd Edition covers everything the successful earlier edition did as well as plenty more: now fully up to date with Struts 1.1, this edition covers the latest material on tag libraries and the new JavaServerFaces (JSF) APIs and even includes all-new chapters on JSF, JSTL/EL, and security • • • • • • Table of Contents Index Reviews Reader Reviews Errata Academic Programming Jakarta Struts, 2nd Edition By Chuck Cavaness Publisher : O'Reilly Pub Date : June 2004 ISBN : 0-596-00651-9 Pages : 470 Copyright Preface Organization Conventions Used in This Book Using Code Examples Comments and Questions Acknowledgments Chapter 1 Introduction Section 1.1 A Brief History of the Web Section 1.2 What Are Java Servlets? Section 1.4 JSP Model 1 and Model 2 Architectures Section 1.6 What Is a Framework? Section 1.3 JavaServer Pages Section 1.5 Why Is Model-View-Controller So Important? Section 1.7 Alternatives to Struts Chapter 2 Inside the Web Tier Section 2.1 An Architecture Overview Section 2.2 The HTTP Request/Response Phase Section 2.3 Struts and Scope Section 2.4 Using URL Parameters Section 2.5 Forward Versus Redirect Chapter 3 Overview of the Struts Framework Section 3.1 A Banking Account Example Section 3.2 Looking at the Big Picture Section 3.4 Struts Model Components Section 3.6 Multiple Application Support Section 3.3 Struts Controller Components Section 3.5 Struts View Components Section 3.7 Summary Chapter 4 Configuring Struts Applications Section 4.1 The Storefront Application Section 4.2 What Is a Web Application? Section 4.3 The Web Application Directory Structure Section 4.5 Configuring the web.xml File for Struts Section 4.7 The Digester Component Section 4.4 The Web Application Deployment Descriptor Section 4.6 The Struts Configuration File Section 4.8 The Struts Console Tool Section 4.9 Reloading the Configuration Files Chapter 5 Struts Controller Components Section 5.1 The Controller Mechanism Section 5.2 The Utilities Classes Chapter 6 Struts Model Components Section 6.1 The "M" in MVC Section 6.2 What Is a Business Object? Section 6.3 Persistence Section 6.4 What Does Struts Offer for the Model? Chapter 7 Struts View Components Section 7.1 What Is a View? Section 7.2 What Are ActionForms? Section 7.4 Performing Presentation Validation Section 7.6 Looking Ahead to JavaServer Faces Section 7.3 Using ActionErrors Section 7.5 Using the DynaActionForm Class Chapter 8 JSP Custom Tag Libraries Section 8.1 Custom Tags Overview Section 8.2 Tag Libraries Included with Struts Section 8.3 Using JavaBeans with Struts Tags Section 8.5 Logic Tags Section 8.7 Nested Tags Section 8.4 Struts HTML Tags Section 8.6 Bean Tags Section 8.8 Other Useful Tag Libraries Section 8.9 The JSP Standard Tag Library (JSTL) Chapter 9 Extending the Struts Framework Section 9.1 What Are Extension Points? Section 9.2 General Extension Points Section 9.4 Extending View Components Section 9.3 Controller Extension Points Section 9.5 Downsides to Extending the Framework Chapter 10 Exception Handling Section 10.1 Java Exception Handling Section 10.2 Performance Impact of Exception Handling Section 10.3 System Versus Application Exceptions Section 10.5 Exception Handling Provided by Struts Section 10.4 Using Chained Exceptions Section 10.6 Tying Up the Loose Ends Section 10.7 Conclusion Chapter 11 The Validator Framework Section 11.1 The Need for a Validation Framework Section 11.2 Installing and Configuring the Validator Section 11.4 Creating Your Own Validation Rules Section 11.6 Internationalizing the Validation Section 11.3 Using an ActionForm with the Validator Section 11.5 The Validator and JSP Custom Tags Section 11.7 Using the Validator Outside of Struts Chapter 12 Internationalization and Struts Section 12.1 What Is Internationalization? Section 12.2 Support for I18N in Java Section 12.3 Internationalizing Your Struts Applications Section 12.4 Exception Handling and Internationalization Chapter 13 Struts and Enterprise JavaBeans Section 13.1 Implementing the Storefront Service Using EJB Section 13.2 Interfacing Struts to EJB Section 13.3 Conclusion Chapter 14 Using Tiles Section 14.1 Understanding Templates Section 14.2 Installing and Configuring Tiles Section 14.4 The Tiles Tag Library Section 14.3 Using Tiles Section 14.5 Using Definitions Section 14.6 Internationalization Support with Tiles Chapter 15 Logging in a Struts Application Section 15.1 Logging in a Web Application Section 15.2 Using the Servlet Container for Logging Section 15.4 Using the log4j Package Section 15.6 The Performance Impact of log4j Section 15.3 Jakarta Commons Logging Section 15.5 Using Commons Logging in JSP Pages Section 15.7 Third-Party log4j Extensions Section 15.8 Java 1.4 Logging API Chapter 16 Packaging Your Struts Application Section 16.1 To Package or Not to Package Section 16.2 Packaging the Application as a WAR File Section 16.4 Creating an Automated Build Environment Section 16.3 Building Your Struts Applications with Ant Section 16.5 Restarting Your Server Remotely Chapter 17 Addressing Performance Section 17.1 What Is Good Performance? Section 17.2 Performance Versus Load Testing Section 17.3 Performance- and Stress-Testing Tools Section 17.4 Testing the Storefront Application Section 17.5 Performance and Scalability Gotchas Chapter 18 JavaServer Faces Section 18.1 Struts and JavaServer Faces Section 18.2 Overview of JSF Architecture Section 18.4 Converting Existing Struts Applications to JSF Section 18.3 Installing and Running the Example Struts-Faces Application Section 18.5 Further Reading Appendix A Changes Since Struts 1.0 Section A.1 ActionServlet and RequestProcessor Section A.2 Modifications to the Struts Action Class Section A.3 Changes to web.xml and struts-config.xml Section A.4 Action Statics Changed Section A.6 New Features of Struts 1.1 Section A.8 Change to Commons Logging Section A.10 Deprecation of the GenericDataSource Section A.5 TagUtils and ModuleUtils Section A.7 The Struts Validator Section A.9 Removal of Admin Actions Section A.11 Dependency on Commons Projects Appendix B Downloading and Installing Struts Section B.1 The Binary Versus Source Distributions Section B.2 Tips on Installing Struts in Tomcat Section B.3 Tips on Installing Struts in WebLogic Section B.4 Tips on Installing Struts in WebSphere Appendix C Resources Section C.1 The Struts Mailing Lists Section C.2 The Struts Resource Web Page Section C.3 Tiles Site Section C.5 The Struts Console Section C.4 Nested Tags Site Section C.6 Easy Struts Project Colophon Index Copyright © 2004 O'Reilly Media, Inc Printed in the United States of America Published by O'Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472 O'Reilly books may be purchased for educational, business, or sales promotional use Online editions are also available for most titles (http://safari.oreilly.com) For more information, contact our corporate/institutional sales department: (800) 998-9938 or corporate@oreilly.com Nutshell Handbook, the Nutshell Handbook logo, and the O'Reilly logo are registered trademarks of O'Reilly Media, Inc The Java Series, Programming Jakarta Struts, the image of a percheron, and related trade dress are trademarks of O'Reilly Media, Inc Java™ and all Java-based trademarks and logos are trademarks or registered trade marks of Sun Microsystems, Inc., in the United States and other countries Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks Where those designations appear in this book, and O'Reilly Media, Inc was aware of a trademark claim, the designations have been printed in caps or initial caps While every precaution has been taken in the preparation of this book, the publisher and authors assume no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein Preface Over the last few years, web development has turned a very important corner Gone are the days when Java™ developers wrestled with a single JSP that contained presentation logic, database access via SQL, and navigational intelligence Java web developers have learned from their mistakes, paid the price in debugging and maintenance time, and moved on The number and variety of readily available web frameworks today is immense It's hard to point a browser at a Java technical site without finding a newly released web framework that's going to revolutionize the modern world While some may see this as a bad thing that might divide the Java community, the truth is that the constant emergence of new frameworks is just evolution at work The design and construction of today's nontrivial web applications pushes developers to the limit of what's logically and physically possible Myriad solutions are thrown at the problems these applications present Some of the solutions stick, and as with human evolution, valuable characteristics are passed on in future generations of software Other solutions do notthose that fail to serve the needs of users and add value usually fall by the wayside Through this evolutionary process, the Jakarta Struts framework (created by Craig R McClanahan and donated to the Apache Software Foundation in 2000) has emerged as one of the best web frameworks available This book covers Version 1.1, which contains many major enhancements over the previous Jakarta Struts release If you are building applications, web-based or not, one of the main things you will learn from this book is that frameworks such as Struts are a great time investment Organization This book begins with a preliminary discussion that lays the groundwork for the rest of the material This discussion will be a refresher for some and completely new for others From there, we explore the components of Struts's MVC implementation, including a look at the JSP custom tags that are part of the framework Then, to round out your understanding of the value of the Struts framework, we look at several complicated but important topics related to building web-based applications Chapter 1, Introduction This chapter discusses some preliminary concepts, such as the MVC pattern, Model 2, and the idea of a software framework Although many developers may already be familiar with some or all of the ideas presented here, I want to ensure that all readers are starting from the same place The concepts presented in this chapter help to lay the foundation for the rest of the book Chapter 2, Inside the Web Tier The Struts framework is based on the Java Servlet technology and, to a lesser extent, JavaServer Pages, and therefore is tightly coupled to a web container For Struts developers, understanding how the web container processes client requests is fundamental to understanding the framework itself This chapter discusses the components of the web container and the responsibilities of each Velocity WebMacro WebWork applications architectural view of building with Ant configuring converting to JSF directory guidelines JavaBeans, and logging in packaging binary versus source distributions building from the binary distribution building from the source distribution component packages configuration DTD configuration files 2nd complete example configuring a data source declaring ActionForms example that uses declarative exception handling multiple reloading configuring the web.xml file controller components 2nd [See also MVC]3rd diagram controller responsibilities controller servlet [See ActionServlet] declarative exception handling EJB (Enterprise JavaBeans) interfacing to framework Commons Logging package, and creation of dependencies extending overview servlet as a controller (diagram) top-level packages GUI tools initialization process mailing lists 2nd model components performance and scalability problems request scope, and tag libraries 2nd tips on installing Version 1.0, changes since Version 1.1, new features in view components 2nd views within the framework welcome file list Struts Console download page Struts Resource Page Struts Validator [See Validator framework] struts-config.xml file 2nd changes to complete example struts-config_1_1.dtd file STRUTS-DEV mailing list struts-faces library STRUTS-USER mailing list StrutsValidator class stylesheets as view components substring-matching tags, custom tags (Logic tag library) Sun';s own JSF Site super.init( ) method surrogate keys SwitchAction class synchronization log4j, and synchronization and the web container synchronized keyword syntactic validation system exceptions [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] tabs layout tag handler tag libraries 2nd [See also custom tags] Bean components configuring custom defined example of how tags can be grouped logically HTML JSTL Log using to dump information Logic mapping Nested Struts, included with Tiles adding Validator framework, and versus JSP scriptlets tag library descriptor (TLD) file taglib elements taglib package taglib-location element taglib-uri element Taglibs project and log4j TagUtils class Task Scheduler Telnet, used to inspect the HTTP response header Template tag library templates 2nd [See also Tiles framework] body-content section defined example of a template for the storefront application index.jsp example using a template versus the JSP include mechanism testing load versus performance performance and stress testing tools storefront application general steps to be followed stress testing applications throughput Throwable class, partial hierarchy tree for throws clause of a method signature tiers [See architectural tiers] tile [See Tiles framework] Tiles framework configuring Tiles to work with Struts installing and configuring internationalization, and overview plug-in plug-in element set-property elements storefront application (diagram) tiles definitions declaring in a configuration file declaring in a JSP page extending using as forwards in Struts web site tiles package Tiles tag library 2nd adding custom tags add tag definition tag get tag getAsString tag importAttribute tag initComponentDefinitions tag insert tag put tag putList tag useAttribute tag tiles-config.dtd file Tomcat 2nd log4j, and precompiling JavaServer Pages tips on installing Struts in tools stress testing Struts GUI TopLink 2nd Torque TryCatchFinally interface Turbine two-tier applications and model components type attribute, form tag (HTML tag library) [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] Unicode Technology Group upload package, defined URL parameters url-pattern element usability testing useAttribute tag, custom tag (Tiles tag library) user perspective and performance User-Agent, HTTP request header field UserContainer class example extending model components UserView class banking application (example) 2nd util package defined utilities, collection utility classes [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] valid XML document validate( ) method, RequestProcessor class validation [See also Validator framework] business logic logic number (example) presentation rules configuring configuring your own validate a boolean value (example) shipping information, storefront application (example) validation-rules.xml file configuring for Javascript modifying for use outside of Struts validation.xml file checkout form (example) example validation_1_1.dtd validator element classname attribute depends attribute jsFunction Name attribute method attribute methodParams attribute msg attribute name attribute supported attributes Validator framework 2nd 3rd ActionForm, using custom tags default values installing and configuring internationalization, and 2nd JavaScript, using with need for plugging in the Validator required packages required validation rule tag libraries, and using outside of Struts validation rules configuring configuring your own validate a boolean value (example) validator package defined validator-rules_1_1.dtd file ValidatorActionForm class 2nd ValidatorForm class ValidatorPlugIn class 2nd ValidatorServlet Value Object pattern [See DTOs, pattern] value objects [See DTOs] value-comparison tags, custom tags (Logic tag library) VBSF Velocity vertical box layout view components 2nd extending views defined Struts framework, within view queries the model for state information (diagram) within the web tier MVC pattern [See MVC View] volume testing [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] WAR files 2nd creating packaging Struts applications as using Ant to build WAS web applications class loader components defined deployed in a container deploying deployment descriptor defined directory structure event listeners logging in naming conventions stateless connection of WEB-INF classes subdirectory lib subdirectory web containers processing a forward request versus a redirect servlet mappings, and synchronization, and web server working together with servlet containers web tier web-app element 2nd WEB-INF classes subdirectory lib subdirectory web.xml file 2nd 3rd changes to configuring for Struts error handling, in examples combining the servlet-mapping element with the servlet element configuring multiple subapplications declaring initialization parameters how path mapping is configured how tag libraries are configured using the error-page element to prevent users from seeing 404 or 500 errors using the servlet element to configure the servlet class tag library inclusions WebLoad Weblogic WebLogic precompiling JavaServer Pages tips on installing Struts in WebSphere tips in installing Struts in WebWork welcome file list setting up welcome-file-list element storefront application (example) Struts action, and welcome.jsp file well-formed XML document Winterfeldt, David Write Once, Run Anywhere write tag, custom tag (Bean tag library) [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] XDoclet XML (Extensible Markup Language) document valid well-formed XML tags, JSTL XML/XSLT as alternative to JSP XMLC, Java-based compiler ...and security • • • • • • Table of Contents Index Reviews Reader Reviews Errata Academic Programming Jakarta Struts, 2nd Edition By Chuck Cavaness Publisher : O'Reilly Pub Date : June 2004 ISBN : 0-596-00651-9... Tips on Installing Struts in WebSphere Appendix C Resources Section C.1 The Struts Mailing Lists Section C.2 The Struts Resource Web Page Section C.3 Tiles Site Section C.5 The Struts Console... An attribution usually includes the title, author, publisher, and ISBN For example: "Programming Jakarta Struts, Second Edition, by Chuck Cavaness Copyright 2004 O'Reilly Media, Inc., 0-59600651-9."

Ngày đăng: 25/03/2019, 16:45

TỪ KHÓA LIÊN QUAN