ebook img

Stripes . . . and Java Web Development Is Fun Again PDF

391 Pages·2009·2.68 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Stripes . . . and Java Web Development Is Fun Again

What readers are saying about Stripes...and Java Web Development Is Fun Again This book is a must for anyone using Stripes, novice or pro. The author has done a great job of explaining the basics as well as the details of Stripes’ amazing features while showing how to build a real- life application. A novice developer can get up to speed fast, keeping with Stripes’ pragmatic approach to development: “It doesn’t have to be hard.” As the chapters progress, you will gain thorough knowledge of all the Stripes features. What really impressed me was the author’s dedication to giving you full examples of all the possible variations; you’re not left thinking, “If I just knew how to use that feature.”If you want to know how to use a Stripes feature, look it up in this book—it’s definitely covered. Stripes...and Java WebDevelopmentIsFun Again will be on my work desk from now on. Jeppe Cramon Chief Architect, TigerTeam This book is really engaging. Since I’m familiar with Stripes, I enjoyed learning about many lesser-known nuances that Stripes provides— and those tasty little nuggets kept me reading. This book delivers a comprehensive understanding of the intellectual and technical aspects of Stripes. It has served to cement my appreciation for Stripes. Brandon Goodin Coauthor, iBATISinAction Prepared exclusively for Trieu Nguyen At first I thought this book would be merely a welcome dead-tree ref- erence for our team of self-proclaimed veteran Stripes developers. But somewhere along the way Frederic Daoud managed to greatly impress and humble me with his experience and in-depth knowledge of Stripes. With its clear and well-structured chapters, the content is thorough and fast-moving. The text flows naturally from topic to topic and from chapter to chapter. The code is good, clear, and readable. The tone is personal and light, like the author is casually chatting with us, the readers. This was very appealing to me, having read truckloads of dry, almost scientific comp-sci books. And even I, as a long-time Stripes user, learned some things I didn’t know. Jasper Fontaine Lead Developer, Codegap As a Stripes committer, I learned a good bit fromreading this book. For example, the explanation of how checkboxes are handled is very informative. In fact, I might print it out and hang it above my desk! Even seasoned Stripes developers get confused by that sometimes. Thanks, Frederic. Ben Gunter Committer, The Stripes Framework I changed several of my practices after reading this book. The book contains some really great ideas, and I really was surprised I learned so much from it! Aaron Porter Committer, The Stripes Framework This is a valuable resource to both newcomers and experienced Stripes developers. Although Stripes is very easy to use, this is the book I wish I had read when I got started! Having used Stripes for more than a year, I still found many great tips that will help me improve and simplify my code. Chris Herron Freelance Java Developer Prepared exclusively for Trieu Nguyen Prepared exclusively for Trieu Nguyen Stripes ...and Java Web Development Is Fun Again Frederic Daoud with Tim Fennell The Pragmatic Bookshelf Raleigh,NorthCarolina Dallas,Texas Prepared exclusively for Trieu Nguyen Many of the designations used by manufacturers and sellers to distinguish their prod- uctsareclaimedastrademarks.Wherethosedesignationsappearinthisbook,andThe Pragmatic Programmers, LLC was aware of a trademark claim, the designations have been printed in initial capital letters or in all capitals. The Pragmatic Starter Kit, The PragmaticProgrammer,PragmaticProgramming,PragmaticBookshelfandthelinkingg devicearetrademarksofThePragmaticProgrammers,LLC. Every precaution was taken in the preparation of this book. However, the publisher assumesnoresponsibility for errorsor omissions,or for damagesthatmay result from theuseofinformation(includingprogramlistings)containedherein. Our Pragmatic courses, workshops, and other products can help you and your team create better software and have more fun. For more information, as well as the latest Pragmatictitles,pleasevisitusat http://www.pragprog.com Copyright©2008FredericDaoud. Allrightsreserved. Nopartofthispublicationmaybereproduced,storedinaretrievalsystem,ortransmit- ted, in any form, or by any means, electronic,mechanical,photocopying, recording, or otherwise,withoutthepriorconsentofthepublisher. PrintedintheUnitedStatesofAmerica. ISBN-10:1-934356-21-2 ISBN-13:978-1-934356-21-0 Printedonacid-freepaper. P1.0printing,October2008 Version:2009-4-20 Prepared exclusively for Trieu Nguyen ToNadia. Youaretheloveofmylife andthewomanofmydreams. Prepared exclusively for Trieu Nguyen Prepared exclusively for Trieu Nguyen Contents 1 Introduction 13 1.1 What Can Stripes Do for You? . . . . . . . . . . . . . . . 15 1.2 Getting the Most Out of This Book . . . . . . . . . . . . 16 1.3 Acknowledgments . . . . . . . . . . . . . . . . . . . . . . 19 I Learning the Controls 21 2 Stripes 101: Getting Started 22 2.1 Setting Up a Stripes Application . . . . . . . . . . . . . 22 2.2 Hello, Stripes! . . . . . . . . . . . . . . . . . . . . . . . . 27 2.3 Binding to Action Beans . . . . . . . . . . . . . . . . . . 36 2.4 Wrapping Up . . . . . . . . . . . . . . . . . . . . . . . . . 39 3 The Core: Action Beans and JSPs 40 3.1 Let’s CRUD . . . . . . . . . . . . . . . . . . . . . . . . . . 41 3.2 Writing a Base for a Stripes Application . . . . . . . . . 43 3.3 Displaying Data with Action Beans and JSPs . . . . . . 46 3.4 Parameterized Links . . . . . . . . . . . . . . . . . . . . 52 3.5 Displaying Messages to the User . . . . . . . . . . . . . 57 3.6 Creating Forms . . . . . . . . . . . . . . . . . . . . . . . 60 3.7 Use a Forward or a Redirect? . . . . . . . . . . . . . . . 67 4 Validating User Input 70 4.1 Stripes Validation Concepts . . . . . . . . . . . . . . . . 70 4.2 Using Built-in Validations . . . . . . . . . . . . . . . . . 76 4.3 When You Need More: Custom Validation Methods . . 88 5 There’sMoretoLifeThanStrings:WorkingwithDataTypes 98 5.1 Type Conversion Concepts . . . . . . . . . . . . . . . . . 98 5.2 Built-in Type Converters . . . . . . . . . . . . . . . . . . 100 5.3 Formatting . . . . . . . . . . . . . . . . . . . . . . . . . . 107 5.4 Working with Custom Data Types. . . . . . . . . . . . . 110 Prepared exclusively for Trieu Nguyen CONTENTS 10 6 Customizing Stripes Messages 121 6.1 Customizing Information Messages . . . . . . . . . . . . 121 6.2 Customizing Error Messages . . . . . . . . . . . . . . . 124 6.3 Changing the Text of Error Messages . . . . . . . . . . 131 6.4 Creating Messages for Custom Errors . . . . . . . . . . 138 7 Reusable Layouts 141 7.1 Basic Stripes Layout Concepts . . . . . . . . . . . . . . 142 7.2 Putting Layouts to Work: Decorators . . . . . . . . . . . 146 7.3 Using View Helpers . . . . . . . . . . . . . . . . . . . . . 156 7.4 If You’re Used to Tiles or SiteMesh . . . . . . . . . . . . 161 II Revving Up 165 8 Adding Form Input Controls 166 8.1 Checkboxes . . . . . . . . . . . . . . . . . . . . . . . . . 167 8.2 Select Boxes . . . . . . . . . . . . . . . . . . . . . . . . . 170 8.3 Image Buttons and Text Areas . . . . . . . . . . . . . . 174 8.4 Using Cross-page Controls . . . . . . . . . . . . . . . . . 178 8.5 Radio Buttons . . . . . . . . . . . . . . . . . . . . . . . . 180 9 Advanced Features Made Easy 183 9.1 Managing Session Data. . . . . . . . . . . . . . . . . . . 183 9.2 Altering Form Values in the Action Bean . . . . . . . . 188 9.3 Using Indexed Properties . . . . . . . . . . . . . . . . . . 191 9.4 Working with Files . . . . . . . . . . . . . . . . . . . . . 195 10 Registering and Logging In 203 10.1 The Registration Page . . . . . . . . . . . . . . . . . . . . 203 10.2 Adding Password and Confirm Password Boxes . . . . 205 10.3 Dealing with a Bunch of Required Fields . . . . . . . . 207 10.4 Using Validation Metadata . . . . . . . . . . . . . . . . . 208 10.5 Creating a Wizard . . . . . . . . . . . . . . . . . . . . . . 210 10.6 The Login Page . . . . . . . . . . . . . . . . . . . . . . . . 216 Reporterratum Prepared exclusively for Trieu Nguyen thiscopyis(P1.0printing,October2008)

Description:
with Stripes' pragmatic approach to development: “It doesn't have to be hard. If you're reading the PDF version of this book with a PDF viewer that
See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.