contents


foreword
preface
acknowledgments
about this book



Part 1  Getting started with Wicket


1  What is Wicket?
1.1 How we got here
A developer’s tale
What problems does Wicket solve?
1.2 Wicket in a nutshell
Just Java
Just HTML
The right abstractions
1.3 Have a quick bite of Wicket
Hello, uhm ... World!
Having fun with links
The Wicket echo application
1.4 Summary
2  The architecture of Wicket
2.1 How Wicket handles requests
Request-handling objects
The processing steps involved in request handling
Thread-safety
2.2 Introducing Wicket components
The component triad
Wicket’s Java components
Page: one component to rule them all
Components and markup
Separation of presentation and logic: a good thing?
The component’s data brokers: models
Extending components with behaviors
2.3 Summary
3  Building a cheesy Wicket application
3.1 Introducing Cheesr
Setting up shop
Designing the user interface
3.2 Creating the store front
Cutting to the cheese
Adding the shopping cart
Going to check out
Adding pagination to the list of cheeses
3.3 Creating the checkout page
Adding the billing address form
Adding validation to the billing-address form
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
Using the simple Model
Using PropertyModels for dynamic models
Saving code with CompoundPropertyModels
4.3 Keeping things small and fresh: detachable models
What is detaching?
Working around a serialization problem with detachable models
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
Using the Label component to render text
Displaying multiple lines using a MultiLineLabel
Displaying formatted text using labels
5.3 Navigating using links
Linking to documents using static links
Using ExternalLink to render links programmatically
Linking to Wicket pages with BookmarkablePageLinks
Adding bookmarkable links automatically with wicket:link
5.4 Responding to client actions with a link
Using Link to respond to client actions
Using AjaxFallbackLink to respond to client actions
5.5 Using repeaters to repeat markup and components
Using the RepeatingView to repeat markup and components
Using a ListView to repeat markup and components
5.6 Performing common tasks with components
Hiding parts of a page
Manipulating markup attributes
Removing excess markup
5.7 Summary
6  Processing user input using forms
6.1 What are forms?
6.2 How does form processing work?
Submitting a form from the browser to the server
Processing the form submission on the server
6.3 Components for text input
Using a TextField to process single-line text
Using a PasswordTextField to process a password
Using a TextArea to process multiline text
6.4 Selecting from a list of items
Selecting a single value from a list of choices
Selecting multiple values from a list of choices
Mapping an object to a choice and back using a ChoiceRenderer
Using check boxes for boolean properties
6.5 Components for submitting form data
Using buttons to submit data
Using links to submit data
Using Ajax to submit data
Skipping Wicket’s form processing
6.6 Validating user input
Making a field required
Converting user input from strings to domain types
Using Wicket’s supplied validators
Writing your own validator
6.7 Providing feedback
Feedback messages
Using the info, error, and warn methods for general messages
Displaying feedback messages using a FeedbackPanel
6.8 Summary
7  Composing your pages
7.1 Grouping components
Grouping components on a page: WebMarkupContainer
Reusing grouped components by creating a Panel
Grouping components using fragments
7.2 Page composition: creating a consistent layout
Creating consistent layouts using plain pages
Creating consistent layouts using markup inheritance
Creating consistent layouts using panels
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
What are reusable custom components?
Implementing the locale-selector component
Creating a compound component
Adding a Reset link
8.3 Developing a compound component: DateTimeField
Composite input components
Embedding form components
Synchronizing the models of the embedded components
8.4 Developing a discount list component
The container
The read-only discounts list
The edit-discounts list
8.5 Summary
9  Images, CSS, and scripts: working with resources
9.1 Using packaged resources
Including packaged resources using auto-linking
9.2 Building export functionality as a resource
Creating the resource
Letting a component host the resource
Making the export available as a shared resource
Initializing the shared resource
An alternative implementation
9.3 Resources and third-party libraries
A JCaptcha image component
Implementing a complete JCaptcha form
9.4 Summary
10  Rich components and Ajax
10.1 Asynchronous JavaScript and XML (Ajax)
Ajax explained
Ajax support in Wicket
Ajax components
Ajax behaviors
10.2 Header contributions
Using header-contributing behaviors
Using the header contributor interface
Using the wicket:head tag
10.3 Ajaxifying the cheese discounts
Implementing in-place editing
Refactoring the discount list
How AjaxEditableLabel works
10.4 Creating your own Ajax components
Using third-party Ajax engines
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
Keeping track of the user
Authenticating the user
Building a user panel
Building a page for signing out
11.3 Implementing authorization
Introducing authorization strategies
Protecting the discounts page
Disabling the Edit link for unauthorized users
11.4 Summary
12  Conquer the world with l10n and i18n
12.1 Supporting multiple languages
Localizing the UserPanel
Using <wicket:message> tags
The message-lookup algorithm
Localized markup files
12.2 Customizing resource loading
12.3 Localized conversions
Wicket converters
Custom converters
12.4 Summary
13  Multitiered architectures
13.1 Introducing the three-tiered service architecture
Advantages of utilizing a layered architecture
Who is in charge of the dependencies?
Code without dependency injection
Dependency injection to the rescue
13.2 Layering Wicket applications using Spring
Spring time!
The simplest way to configure Wicket to use Spring
Using proxies instead of direct references
Using proxies from the wicket-spring project
Wicket’s Spring bean annotations
Using Spring bean annotations with objects that aren’t Wicket components
13.3 Implementing the data tier using Hibernate
Introducing Hibernate
Configuring Hibernate
Implementing data access objects using Hibernate
Wicket/Hibernate pitfalls
13.4 Summary
14  Putting your application into production
14.1 Testing your Wicket application
Unit-testing Hello, World
Having fun with link tests
Testing the Wicket Echo application
Testing validators on Cheesr’s checkout page
Testing a panel directly with the ShoppingCartPanel
14.2 Optimizing URLs for search engines and visitors
Bookmarkable requests vs. session-relative requests
Extreme URL makeover: mounting and URL encodings
14.3 Configuring your application for production
Switching to deployment mode for optimal performance
Providing meaningful error pages
14.4 Knowing what is happening in your application
Logging requests with RequestLogger
Using JMX to work under the hood while driving
14.5 Summary


index