Struts

Páginas: 174 (43490 palabras) Publicado: 9 de octubre de 2011
S t ru t s S u rv i v a l G u i d e
Ba s i c s t o Be s t P r a c t i c e s

Covers Struts 1.1
Srikanth Shenoy

Austin

2

ObjectSource LLC books are available for bulk purchases for corporations and other organizations. The publisher offers discounts when ordered in bulk. For more information please contact: Sales Department ObjectSource LLC. 2811 La Frontera Blvd., Suite 517 Austin,TX 78728 Email: sales@objectsource.com First corrected reprint Copyright ©2004,2005 ObjectSource LLC. All rights reserved. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means electronic, mechanical, photocopying, recording or otherwise, without the prior written permission of the publisher. Many of thedesignations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and ObjectSource LLC, was aware of a trademark claim, the designations have been printed in initial capital letters. The author and the publisher have taken care in preparation of this book, but make no express or implied warranty of any kind and assume noresponsibility for errors or omissions. In no event shall the ObjectSource LLC or the authors be liable for any direct, indirect, incidental, special, exemplary or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strictliability, or tort (including negligence or otherwise) arising in any way out of use of the information or programs contained herein.

Published by ObjectSource LLC 2811 La Frontera Blvd., Suite 517, Austin TX 78728 Printing RJ Communications nd 51 East 42 Street, Suite 1202, NewYork NY 10017 Cover Design Matt Pramschufer Budget Media Design Pleasantville, New York Library of Congress Catalog Number:2004100026

ISBN: 0-9748488-0-8 (paperback)

Printed in the United States of America

3

4

5

Table of Contents
Chapter 1. Getting Started ..........................................................................................15 J2EE Platform 15 J2EE web application 16 JSPs Error! Bookmark not defined. 1.1 Model 1 Architecture 20 Problems with Model 1 Architecture 20 1.2 Model2 Architecture - MVC 21 Advantages of Model 2 Architecture 22 Controller gone bad – Fat Controller 23 1.3 MVC with configurable controller 23 1.4 First look at Struts 25 1.5 Tomcat and Struts installation 28 1.6 Summary 28 Chapter 2. Struts Framework Components...............................................................30 2.1 Struts request lifecycle 31 ActionServlet 31 RequestProcessor andActionMapping 33 ActionForm 34 Action 35 ActionForward 36 ActionErrors and ActionError 37 2.2 Struts Configuration File – struts-config.xml 39 2.3 View Components 42 How FormTag works 43 How ErrorsTag works 45 2.4 Summary 47 Chapter 3. Your first Struts application ....................................................................48 3.1 Introduction 48 3.2 Hello World – step by step 49 3.3 Lights,Camera, Action! 61 3.4 Handling multiple buttons in HTML Form 63 3.5 Value replacement in Message Resource Bundle 65 3.6 Summary 67 Chapter 4. All about Actions .......................................................................................68 4.1 ForwardAction 68 MVC compliant usage of LinkTag 69 Using LinkTag’s action attribute 70 Using LinkTag’s forward attribute 70 Using ForwardActionfor Integration 71 ForwardAction Hands-on 72 4.2 Protecting JSPs from direct access 72 4.3 IncludeAction 75 4.4 DispatchAction 76 4.5 LookupDispatchAction 80 4.6 Configuring multiple application modules 82 4.7 Roll your own Base Action and Form 85 4.8 Handling Duplicate Form Submissions 88 4.9 What goes into Action (and what doesn’t) 91 4.10 When to use Action chaining (and when not to) 93

6...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Struts
  • Struts
  • Struts
  • Struts
  • Struts 2
  • Struts Java
  • Struts Introduction
  • Struts (resumen)

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS