Wicket in Action
Martijn Dashorst and Eelco Hillenius
Foreword by Jonathan Locke
  • July 2008
  • ISBN 9781932394986
  • 392 pages
  • printed in black & white

This is the complete and authoritative guide to Wicket, written and reviewed by the core members of the Apache Wicket team. If there's anything you want to know about Wicket, you are sure to find it in this book.

Jonathan Locke, Founder and Architect of Apache Wicket

Wicket in Action is a comprehensive guide for Java developers building Wicket-based web applications. It introduces Wicket's structure and components, and moves quickly into examples of Wicket at work. Written by core committers, this book shows you the "how-to" and the "why" of Wicket. You'll learn to use and customize Wicket components, to interact with Spring and Hibernate, and to implement rich Ajax-driven features.

About the Technology

Wicket bridges the mismatch between the web's stateless protocol and Java's OO model. The component-based Wicket framework shields you from the HTTP under a web app so you can concentrate on business problems instead of the plumbing code. In Wicket, you use logic-free HTML templates for layout and standard Java for an application's behavior. The result? Coding a web app with Wicket feels more like regular Java programming.

Table of Contents detailed table of contents




about this book

Part 1 Getting started with Wicket

1. What is Wicket?

1.1. How we got here

1.1.1. A developer’s tale

1.1.2. What problems does Wicket solve?

1.2. Wicket in a nutshell

1.2.1. Just Java

1.2.2. Just HTML

1.2.3. The right abstractions

1.3. Have a quick bite of Wicket

1.3.1. Hello, uhm…​ World!

1.3.3. The Wicket echo application

1.4. Summary

2. The architecture of Wicket

2.1. How Wicket handles requests

2.1.1. Request-handling objects

2.1.2. The processing steps involved in request handling

2.1.3. Thread-safety

2.2. Introducing Wicket components

2.2.1. The component triad

2.2.2. Wicket’s Java components

2.2.3. Page: one component to rule them all

2.2.4. Components and markup

2.2.5. Separation of presentation and logic: a good thing?

2.2.6. The component’s data brokers: models

2.2.7. Extending components with behaviors

2.3. Summary

3. Building a cheesy Wicket application

3.1. Introducing Cheesr

3.1.1. Setting up shop

3.1.2. Designing the user interface

3.2. Creating the store front

3.2.1. Cutting to the cheese

3.2.2. Adding the shopping cart

3.2.3. Going to check out

3.2.4. Adding pagination to the list of cheeses

3.3. Creating the checkout page

3.3.1. Adding the billing address form

3.3.2. Adding validation to the billing-address form

3.3.3. Creating a reusable shopping cart

3.4. Summary

Part 2 Ingredients for your Wicket applications

4. Understanding models

4.1. What are models?

4.2. A taste of the standard models

4.2.1. Using the simple Model

4.2.2. Using PropertyModels for dynamic models

4.2.3. Saving code with CompoundPropertyModels

4.3. Keeping things small and fresh: detachable models

4.3.1. What is detaching?

4.3.2. Working around a serialization problem with detachable models

4.3.3. Using LoadableDetachableModel

4.4. Nesting models for fun and profit

4.5. Summary

5. Working with components: labels, links, and repeaters

5.1. What are components?

5.2. Displaying text with label components

5.2.1. Using the Label component to render text

5.2.2. Displaying multiple lines using a MultiLineLabel

5.2.3. Displaying formatted text using labels

5.5. Using repeaters to repeat markup and components

5.5.1. Using the RepeatingView to repeat markup and components

5.5.2. Using a ListView to repeat markup and components

5.6. Performing common tasks with components

5.6.1. Hiding parts of a page

5.6.2. Manipulating markup attributes

5.6.3. Removing excess markup

5.7. Summary

6. Processing user input using forms

6.1. What are forms?

6.2. How does form processing work?

6.2.1. Submitting a form from the browser to the server

6.2.2. Processing the form submission on the server

6.3. Components for text input

6.3.1. Using a TextField to process single-line text

6.3.2. Using a PasswordTextField to process a password

6.3.3. Using a TextArea to process multiline text

6.4. Selecting from a list of items

6.4.1. Selecting a single value from a list of choices

6.4.2. Selecting multiple values from a list of choices

6.4.3. Mapping an object to a choice and back using a ChoiceRenderer

6.4.4. Using check boxes for boolean properties

6.5. Components for submitting form data

6.5.1. Using buttons to submit data

6.5.3. Using Ajax to submit data

6.5.4. Skipping Wicket’s form processing

6.6. Validating user input

6.6.1. Making a field required

6.6.2. Converting user input from strings to domain types

6.6.3. Using Wicket’s supplied validators

6.6.4. Writing your own validator

6.7. Providing feedback

6.7.1. Feedback messages

6.7.2. Using the info, error, and warn methods for general messages

6.7.3. Displaying feedback messages using a FeedbackPanel

6.8. Summary

7. Composing your pages

7.1. Grouping components

7.1.1. Grouping components on a page: WebMarkupContainer

7.1.2. Reusing grouped components by creating a Panel

7.1.3. Grouping components using fragments

7.2. Page composition: creating a consistent layout

7.2.1. Creating consistent layouts using plain pages

7.2.2. Creating consistent layouts using markup inheritance

7.2.3. Creating consistent layouts using panels

7.2.4. Which is the best?

7.3. Summary

Part 3 Going beyond Wicket basics

8. Developing reusable components

8.1. Why create custom reusable components?

8.2. Creating a component that selects the current locale

8.2.1. What are reusable custom components?

8.2.2. Implementing the locale-selector component

8.2.3. Creating a compound component

8.3. Developing a compound component: DateTimeField

8.3.1. Composite input components

8.3.2. Embedding form components

8.3.3. Synchronizing the models of the embedded components

8.4. Developing a discount list component

8.4.1. The container

8.4.2. The read-only discounts list

8.4.3. The edit-discounts list

8.5. Summary

9. Images, CSS, and scripts: working with resources

9.1. Using packaged resources

9.1.1. Including packaged resources using auto-linking

9.2. Building export functionality as a resource

9.2.1. Creating the resource

9.2.2. Letting a component host the resource

9.2.3. Making the export available as a shared resource

9.2.4. Initializing the shared resource

9.2.5. An alternative implementation

9.3. Resources and third-party libraries

9.3.1. A JCaptcha image component

9.3.2. Implementing a complete JCaptcha form

9.4. Summary

10. Rich components and Ajax

10.1. Asynchronous JavaScript and XML (Ajax)

10.1.1. Ajax explained

10.1.2. Ajax support in Wicket

10.1.3. Ajax components

10.1.4. Ajax behaviors

10.2. Header contributions

10.2.1. Using header-contributing behaviors

10.2.2. Using the header contributor interface

10.2.3. Using the wicket:head tag

10.3. Ajaxifying the cheese discounts

10.3.1. Implementing in-place editing

10.3.2. Refactoring the discount list

10.3.3. How AjaxEditableLabel works

10.4. Creating your own Ajax components

10.4.1. Using third-party Ajax engines

10.4.2. Detecting client capabilities

10.5. Gotchas when working with Wicket and Ajax

10.6. Summary

Part 4 Preparing for the real world

11. Securing your application

11.1. Session-relative pages

11.2. Implementing authentication

11.2.1. Keeping track of the user

11.2.2. Authenticating the user

11.2.3. Building a user panel

11.2.4. Building a page for signing out

11.3. Implementing authorization

11.3.1. Introducing authorization strategies

11.3.2. Protecting the discounts page

11.4. Summary

12. Conquer the world with l10n and i18n

12.1. Supporting multiple languages

12.1.1. Localizing the UserPanel

12.1.2. Using <wicket:message> tags

12.1.3. The message-lookup algorithm

12.1.4. Localized markup files

12.2. Customizing resource loading

12.3. Localized conversions

12.3.1. Wicket converters

12.3.2. Custom converters

12.4. Summary

13. Multitiered architectures

13.1. Introducing the three-tiered service architecture

13.1.1. Advantages of utilizing a layered architecture

13.1.2. Who is in charge of the dependencies?

13.1.3. Code without dependency injection

13.1.4. Dependency injection to the rescue

13.2. Layering Wicket applications using Spring

13.2.1. Spring time!

13.2.2. The simplest way to configure Wicket to use Spring

13.2.3. Using proxies instead of direct references

13.2.4. Using proxies from the wicket-spring project

13.2.5. Wicket’s Spring bean annotations

13.2.6. Using Spring bean annotations with objects that aren’t Wicket components

13.3. Implementing the data tier using Hibernate

13.3.1. Introducing Hibernate

13.3.2. Configuring Hibernate

13.3.3. Implementing data access objects using Hibernate

13.3.4. Wicket/Hibernate pitfalls

13.4. Summary

14. Putting your application into production

14.1. Testing your Wicket application

14.1.1. Unit-testing Hello, World

14.1.3. Testing the Wicket Echo application

14.1.4. Testing validators on Cheesr’s checkout page

14.1.5. Testing a panel directly with the ShoppingCartPanel

14.2. Optimizing URLs for search engines and visitors

14.2.1. Bookmarkable requests vs. session-relative requests

14.2.2. Extreme URL makeover: mounting and URL encodings

14.3. Configuring your application for production

14.3.1. Switching to deployment mode for optimal performance

14.3.2. Providing meaningful error pages

14.4. Knowing what is happening in your application

14.4.1. Logging requests with RequestLogger

14.4.2. Using JMX to work under the hood while driving

14.5. Summary

15. Setting up a Wicket project — Bonus Chapter available online only

15.1. Setting up camp

15.1.1. Before you start

15.1.2. The directory structure

15.1.3. The dependencies

15.2. Configuring the build

15.2.1. An Ant build.xml file

15.2.2. A Maven project file

15.3. Creating the application infrastructure

15.3.1. Creating the Application object

15.3.2. Configuring the web.xml file

15.3.3. Embedding a Jetty server

15.3.4. Running the application for the first time

15.4. Using Wicket’s quick-start project generator

15.5. Summary


What's inside

  • All of Wicket's basic concepts and components
  • Security, localization, and internationalization
  • Creating custom reusable components
  • Wicket's Ajax and JavaScript capabilities
  • Working with databases and resources
  • Prepare your application for production

About the authors

Martijn Dashorst is a software engineer with over 10 years of experience in software development. He has been actively involved in the Wicket project since it was open-sourced, and has presented Wicket as a speaker at numerous conferences, including JavaOne and JavaPolis.

Eelco Hillenius is an experienced software developer who has been part of Wicket's core team almost from the start. He works for Teachscape where he is helping to build the next e-learning platform. A Dutch native, he currently lives in Seattle.

placing your order...

Don't refresh or navigate away from the page.
print book $29.99 $44.99 pBook + eBook + liveBook
Additional shipping charges may apply
Wicket in Action (print book) added to cart
continue shopping
go to cart

eBook $24.99 $35.99 3 formats + liveBook
Wicket in Action (eBook) added to cart
continue shopping
go to cart

Prices displayed in rupees will be charged in USD when you check out.

FREE domestic shipping on three or more pBooks