Книга Wicket in Action Wicket in Action Книги WEB дизайн/разработка Автор: Martijn Dashorst, Eelco Hillenius Год издания: 2005 Формат: pdf Издат.:Manning Publications Страниц: 400 Размер: 3,2 ISBN: 1932394982 Язык: Английский 17 (голосов: 1) Оценка:There are dozens of Java frameworks out there, but most of them require you to learn special coding techniques and new, often rigid, patterns of development. Wicket is different. As a component-based Web application framework, Wicket lets you build maintainable enterprise-grade web applications using the power of plain old Java objects (POJOs), HTML, Ajax, Spring, Hibernate and Maven. Wicket automatically manages state at the component level, which means no more awkward HTTPSession objects. Its elegant programming model enables you to write rich web applications quickly. Wicket in Action is an authoritative, comprehensive guide for Java developers building Wicket-based Web applications. This book starts with an introduction to Wicket's structure and components, and moves quickly into examples of Wicket at work. Written by two of the project's earliest and most authoritative experts, this book shows you both the "how-to" and the "why" of Wicket. As you move through the book, you'll learn to use and customize Wicket components, how to interact with other technologies like Spring and Hibernate, and how to build rich, Ajax-driven features into your applications.
Author(s): Martijn Dashorst, Eelco Hillenius
Publisher: Manning
Year: 2005
Language: English
Commentary: 14473
Pages: 373
City: Greenwich, CT
1 What is Wicket?......Page 5
1.1.1 A developer’s tale......Page 6
1.1.2 What problems does Wicket solve?......Page 7
1.2.1 Just Java......Page 12
1.2.2 Just HTML......Page 13
1.3 Have a quick bite of Wicket......Page 15
1.3.1 Hello, uhm... World......Page 16
1.3.2 Having fun with links......Page 18
1.3.3 The Wicket Echo application......Page 22
1.4 Summary......Page 24
2 The architecture of Wicket......Page 25
2.1.1 Request handling objects......Page 26
2.1.2 The processing steps of request handling......Page 30
2.2 Introducing Wicket components......Page 31
2.2.1 The component triad......Page 32
2.2.2 Wicket’s Java components......Page 33
2.2.3 Page: the one component to rule them all......Page 34
2.2.4 Components and markup......Page 35
2.2.5 Intermezzo: matching hierarchies, a good thing?......Page 38
2.2.6 The Component’s data brokers: Models......Page 39
2.2.7 Extending using composition with behaviors......Page 42
2.3 Detaching models and components......Page 44
2.4 Summary......Page 47
3 Setting up a Wicket project......Page 49
3.1.1 Before you start......Page 50
3.1.3 The dependencies......Page 51
3.2 Configuring the build......Page 52
3.2.1 An ant build.xml file......Page 53
3.2.2 A maven project file......Page 55
3.3 Creating the application infrastructure......Page 62
3.3.1 Creating our Application object......Page 63
3.3.2 Configuring the web.xml......Page 64
3.3.3 Embedding a Jetty server......Page 66
3.3.4 Running the application for the first time......Page 67
3.4 Summary......Page 70
4.1 Introducing Cheesr......Page 71
4.1.1 Designing the application......Page 72
4.1.2 Designing the user interface......Page 77
4.2 Creating the store front......Page 81
4.2.1 Cutting to the cheese......Page 82
4.2.2 Adding the shopping cart......Page 86
4.2.3 Going to check out......Page 91
4.3.1 Adding the billing address form......Page 96
4.3.2 Adding validation to the billing address form......Page 101
4.3.3 Creating a reusable shopping cart......Page 104
4.5 Summary......Page 107
5.1 What are models?......Page 109
5.2 A taste of the standard models......Page 111
5.2.1 Using the simple Model......Page 112
5.2.2. Using PropertyModels for dynamic behavior......Page 118
5.2.3. Saving code with CompoundPropertyModels......Page 120
5.3.1 What is this detaching?......Page 125
5.3.3 Using LoadableDetachableModels......Page 129
5.4 Nesting models for profit and fun......Page 132
5.4. Summary......Page 134
6 The basic building blocks......Page 136
6.1 What are components?......Page 137
6.2.1 Using the Label component to render text......Page 139
6.2.2 Displaying multiple lines using a MultiLineLabel......Page 141
6.2.3 Displaying formatted text using labels......Page 142
6.3.1 Linking to documents using static links......Page 144
6.3.3 Linking to Wicket pages with BookmarkablePageLinks......Page 145
6.3.5 Add bookmarkable links automatically with wicket:link......Page 149
6.4 Respond to client actions with a Link......Page 150
6.4.1 Using Link to respond to client actions......Page 151
6.4.2 Using the AjaxFallbackLink to respond to client actions......Page 152
6.3.1 Using the RepeatingView for repeating markup and components......Page 155
6.3.2 Using a ListView for repeating markup and components......Page 158
6.4.1 Hiding parts of a page......Page 161
6.4.2 Manipulating markup attributes......Page 163
6.4.3 Removing excess markup......Page 167
6.5 Summary......Page 169
7.1 What are forms?......Page 171
7.2 How does form processing work?......Page 172
7.2.1 Submitting a form from the browser to the server......Page 173
7.2.2 Processing the form submission on the server......Page 175
7.3.1 Using a TextField for processing normal single line text......Page 177
7.3.2 Using a PasswordTextField for processing a password......Page 179
7.4 Selecting from a list of items......Page 180
7.4.1 Selecting a single value from a list of choices......Page 181
7.4.2 Selecting multiple values from a list of choices......Page 183
7.4.3 Mapping an object to a choice and back using a ChoiceRenderer......Page 185
7.4.4 Using checkboxes for boolean properties......Page 187
7.5.1 Using buttons to submit data......Page 189
7.5.2 Using links to submit data......Page 190
7.5.3 Using Ajax to submit data......Page 191
7.5.4 Bypassing Wicket’s form processing for special purposes......Page 193
7.6.1 Making a field required......Page 195
7.6.3 Using Wicket supplied validators......Page 196
7.6.4 Writing your own validator......Page 197
7.7.1 Feedback messages......Page 199
7.7.2 Using info, error and warn methods for general messages......Page 202
7.7.3 Display feedback messages using a FeedbackPanel......Page 203
7.8 Summary......Page 205
8.1 Grouping components......Page 206
8.1.1 Grouping components on a page: WebMarkupContainer......Page 208
8.1.2 Reusing grouped components by creating a Panel......Page 211
8.1.3 Grouping components using fragments......Page 215
8.2.1 Creating consistent layouts using plain pages......Page 217
8.2.2 Creating consistent layouts using markup inheritance......Page 221
8.2.3 Creating consistent layouts using panels......Page 225
8.2.4 Which is the best?......Page 227
8.3 Summary......Page 229
Developing reusable components......Page 231
9.1.1 What exactly are reusable custom components?......Page 232
9.1.2 Implementing the locale select......Page 234
9.1.3 Creating an aggregate component......Page 235
9.1.4 Adding a reset link......Page 238
9.2.1 Aggregate input components......Page 240
9.2.2 Embedding form components......Page 241
9.2.3 Synchronizing the models of the embedded components......Page 242
9.3 Back to the cheese store: developing a discount list component......Page 245
9.3.1 The container......Page 246
9.3.2 The read-only discounts list......Page 247
9.3.6 The edit discounts list.......Page 249
9.3 Summary......Page 252
10.1 Using packaged resources......Page 254
10.2.1 Creating the resource......Page 257
10.2.2 Letting a component host the resource......Page 258
10.2.3 Making the export available as a shared resource......Page 259
10.2.4 Initializing the shared resource......Page 260
10.2.5 An alternative implementation......Page 261
10.3.1 A JCaptcha image component......Page 262
10.3.2 Implementing a complete JCaptcha form......Page 264
10.4 Summary......Page 267
11.1 Asynchronous Javascript and XML (Ajax)......Page 268
11.1.1 Ajax explained......Page 269
11.1.2 Ajax support in Wicket......Page 271
11.1.3 Ajax components......Page 273
11.1.4 Ajax behaviors......Page 274
11.2 Header Contributions......Page 276
11.2.1 Using header contributing behaviors......Page 277
11.2.3 Using the wicket:head tag......Page 279
11.3 Ajaxifying the cheese discounts......Page 280
11.3.1 Implementing in place editing......Page 281
11.3.2 Refactoring the discount list......Page 282
11.3.3 How AjaxEditableLabel works......Page 284
11.4 Creating your own Ajax components......Page 288
11.4.1 Using third party Ajax engines......Page 289
11.4.2 Detecting client capabilities......Page 291
11.5 Gotchas when working with Wicket and Ajax......Page 292
11.5 Summary......Page 294
Authentication and authorization......Page 295
12.1.1 Keeping track of the user......Page 296
12.1.2 Authenticating the user......Page 298
12.1.3 Building a user panel......Page 300
12.1.4 Building a page for signing out......Page 301
12.2.1 Introducing authorization strategies......Page 302
12.2.2 Protecting the discounts page......Page 304
12.2.3 Disabling the edit link for unauthorized users......Page 306
12.3 Summary......Page 308
Localization......Page 310
13.1 Supporting multiple languages......Page 311
13.1.1 Localizing the UserPanel......Page 312
13.1.2 Using tags......Page 313
13.1.3 The message lookup algorithm......Page 316
13.1.4 Localized markup files......Page 317
13.2 Customizing resource loading......Page 319
13.4 Localized conversions......Page 321
13.4.1 Wicket Converters......Page 322
13.4.2 Custom converters......Page 324
13.5 Summary......Page 326
14.1 Introducing the three-tiered service architecture......Page 327
14.1.1 Who is in charge of the dependencies?......Page 328
14.1.2 Code without Dependency Injection......Page 329
14.1.3 Dependency Injection to the rescue......Page 330
14.2 Layering Wicket applications using Spring......Page 331
14.2.1 Spring time!......Page 332
14.2.2 The simplest way to configure Wicket for using Spring......Page 333
14.2.3 Using proxies instead of direct references......Page 334
14.2.4 Using proxies from the Wicket-Spring project......Page 335
14.2.5 Wicket’s Spring bean annotations......Page 336
14.2.6 Using Spring bean annotations with objects that are not Wicket components......Page 339
14.3.1 Introducing Hibernate......Page 340
14.3.2 Configuring Hibernate......Page 341
14.3.3 Implementing the Data Access Objects using Hibernate......Page 342
14.3.4 Wicket/ Hibernate pitfalls......Page 344
14.4 Summary......Page 346
15.1 Testing your Wicket application......Page 347
15.1.1 Unit testing Hello World!......Page 348
15.1.2 Having fun with testing links......Page 350
15.1.3 Testing the Wicket Echo application......Page 351
15.1.4 Testing validators on Cheesr’s checkout page......Page 352
15.1.5 Testing a panel directly with the ShoppingCartPanel......Page 354
15.2.1 The difference between a bookmarkable request and a session relative request......Page 355
15.2.2 Extreme URL makeover: mounting and URL encodings......Page 357
15.3.1 Switch to deployment mode for optimal performance......Page 361
15.3.2 Provide meaningful error pages to your visitors......Page 364
15.4.1 Log requests with the RequestLogger......Page 367
15.4.2 Use JMX to uncover the hood while driving......Page 370
15.5 Summary......Page 373