You are previewing Apache Wicket Cookbook.
O'Reilly logo
Apache Wicket Cookbook

Book Description

Master Wicket by example by implementing real-life solutions to every day tasks

  • The Apache Wicket Cookbook covers the full spectrum of features offered by the Wicket web framework

  • Implement advanced user interactions by following the live examples given in this Cookbook

  • Create reusable components and speed up your web application development

  • Another title in Packt's Cookbook series giving clear, step-by-step, and to-the-point recipes to perform common and not so common tasks with Wicket

  • In Detail

    Apache Wicket is one of the most famous Java web application frameworks. Wicket simplifies web development and makes it fun. Are you bored of going through countless pages of theory to find out how to get your web development done? With this book in hand, you don't need to go through hundreds of pages to figure out how you will actually build a web application. You will get practical solutions to your common everyday development tasks to pace up your development activities.

    Apache Wicket Cookbook provides you with information that gets your problems solved quickly without beating around the bush. This book is perfect for you if you are ready to take the next step from tutorials and step into the practical world. It will take you beyond the basics of using Apache Wicket and show you how to leverage Wicket's advanced features to create simpler and more maintainable solutions to what at first may seem complex problems.

    You will learn how to integrate with client-side technologies such as JavaScript libraries or Flash components, which will help you to build your application faster. You will discover how to use Wicket paradigms to factor out commonly used code into custom Components, which will reduce the maintenance cost of your application, and how to leverage the existing Wicket Components to make your own code simpler.

    A straightforward Cookbook with over 75 highly focused practical recipes to make your web application development easier with the Wicket web framework

    Table of Contents

    1. Apache Wicket Cookbook
      1. Copyright
      2. Credits
      3. About the Author
      4. About the Reviewers
      5. www.PacktPub.com
        1. Support files, eBooks, discount offers and more
          1. Why Subscribe?
          2. Free Access for Packt account holders
      6. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
        7. Downloading the example code
          1. Errata
          2. Piracy
          3. Questions
      7. 1. Validating and Converting User Input
        1. Introduction
        2. Performing form-level custom validation
          1. Getting ready
          2. How to do it...
            1. How it works...
            2. There's more...
              1. Making validation logic reusable
            3. See also
          3. Creating a custom validator
            1. Getting ready
            2. How to do it...
            3. How it works...
            4. There's more...
              1. Using Wicket's built-in error variables
              2. Using custom error variables
            5. See also
          4. Composing multiple validators into a single reusable validator
            1. Getting ready
            2. How to do it...
              1. How it works...
              2. There's more...
                1. Pitfalls of not encapsulating validation constraints
                2. Pitfalls of not externalizing validation constraints
              3. See also
            3. Converting string inputs to objects
              1. Getting ready
              2. How to do it...
                1. How it works...
                2. There's more...
                  1. How automatic type conversion works
                  2. Global converters
                  3. More on resource strings
                3. See also
      8. 2. Getting Down and Dirty with Forms and Form Components
        1. Introduction
        2. Creating linked selectboxes
          1. Getting ready
          2. How to do it...
            1. How it works...
            2. There's more...
              1. How to trigger a change notification over AJAX
          3. Composing multiple form components into a single reusable component
            1. Getting ready
            2. How to do it...
            3. How it works...
            4. There's more...
              1. Changing the editor to work with a mutable model object
          4. Preventing multiple form submits
            1. Getting ready
            2. How to do it...
              1. How it works...
              2. There's more...
                1. Understanding page versioning
            3. Protecting against spam with a CAPTCHA
              1. Getting ready
              2. How to do it...
                1. How it works...
      9. 3. Making Forms Presentable
        1. Introduction
        2. Changing form component CSS class on validation errors
          1. Getting ready
          2. How to do it...
            1. How it works...
            2. There's more...
              1. Automating component decoration
          3. Using FeedbackPanel to output form component specific messages
            1. Getting ready
            2. How to do it...
              1. How it works...
            3. Streamlining form component presentation using behaviors
              1. Getting ready
              2. How to do it...
                1. How it works...
                2. There's more...
                  1. Making the decorator work with AJAX
      10. 4. Taking your Application Abroad
        1. Introduction
        2. Storing module resource strings in package properties
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Extending Wicket's resource loading
        3. Retrieving a localized string
          1. Getting ready
          2. How to do it...
            1. How it works...
            2. There's more...
              1. The Localizer
          3. Feeding dynamic localized strings to components using StringResourceModel
            1. Getting ready
            2. How to do it...
              1. How it works...
            3. Using wicket:message to output localized markup
              1. How to do it...
                1. How it works...
              2. Overriding localized resources on a case by case basis
                1. Getting ready
                2. How to do it...
                  1. How it works...
                  2. There's more...
                    1. Debugging loading of resources
                  3. How it works...
      11. 5. Displaying Data Using DataTable
        1. Introduction
        2. Sorting
          1. Getting ready
            1. How to do it...
              1. How it works...
              2. There's more...
                1. Adding sort direction indicators via CSS
            2. Filtering
              1. Getting ready
              2. How to do it...
              3. How it works...
              4. There's more...
                1. Sorting database data
            3. Making cells clickable
              1. Getting ready
              2. How to do it...
              3. How it works...
            4. Making rows selectable with checkboxes
              1. Getting ready
              2. How to do it...
                1. How it works...
                2. There's more...
                  1. Adding select/deselect all checkbox
              3. Exporting data to CSV
                1. Getting ready
                2. How to do it...
                  1. How it works...
                  2. There's more...
                    1. Moving data export to a toolbar
      12. 6. Enhancing your UI with Tabs and Borders
        1. Introduction
        2. Creating tabs with dynamic titles
          1. Getting ready
          2. How to do it...
            1. How it works...
            2. There's more...
              1. Optimizing retrieval of item count
          3. Making a tabbed panel play nice with forms
            1. Getting ready
            2. How to do it...
              1. How it works...
              2. There's more...
                1. Making TabbedPanel more form friendly
            3. Creating a client-side JavaScript tabbed panel
              1. Getting ready
              2. How to do it...
                1. How it works...
              3. Using borders to decorate components
                1. Getting ready
                2. How to do it...
                  1. How it works...
                  2. There's more...
                    1. Making stylesheets configurable
                3. Creating a collapsible border
                  1. Getting ready
                  2. How to do it...
                    1. How it works...
                    2. There's more...
                      1. Collapsing the border with AJAX
      13. 7. Deeper into Ajax
        1. Introduction
        2. Adding Ajax validation to individual form components
          1. Getting ready
          2. How to do it...
            1. How it works...
            2. There's more...
              1. Simplifying AJAX validation
          3. Blocking until an Ajax request is complete
            1. Getting ready
            2. How to do it...
            3. How it works...
            4. There's more...
              1. Using a mask to visibly block the UI
          4. Providing Ajax feedback automatically
            1. Getting ready
              1. How to do it...
                1. How it works...
                2. There's more...
                  1. Limiting form processing to validation only
      14. 8. Visualizing Data with Charts
        1. Introduction
        2. Charting with Open Flash Chart
          1. Getting ready
          2. How to do it...
            1. How it works...
            2. There's more...
              1. A better way to write strings
              2. Extracting useful code into reusable blocks
          3. Feeding chart data using a SharedResource
            1. Getting ready
              1. How to do it...
                1. How it works...
                2. There's more...
                  1. Using DynamicWebResource to serve data
              2. Responding to clicks
                1. Getting ready
                  1. How to do it...
                  2. How it works...
                  3. There's more...
                    1. Adding support for multiple graphs
      15. 9. Building Dynamic and Rich UI
        1. Introduction
        2. Swapping components using a select box
          1. Getting ready
          2. How to do it...
            1. How it works...
            2. There's more...
              1. Swapping panels with AJAX
          3. Creating dynamic forms
            1. Getting ready
            2. How to do it...
              1. How it works...
              2. There's more...
                1. Adding select box support to DynaForm
            3. Creating a dynamic portal layout
              1. Getting ready
              2. How to do it...
                1. How it works...
                2. There's more...
                  1. Disabling out-of-bound links
      16. 10. Securing your Application
        1. Introduction
        2. Creating a login page and forcing the user to log in
          1. How to do it...
            1. How it works...
            2. There's more...
              1. Securing only subsets of pages
              2. Taking advantage of a base class
          2. Authenticating with OpenID
            1. Getting ready
            2. How to do it...
              1. How it works...
            3. Securing components using IAuthorizationStrategy
              1. Getting ready
              2. How to do it...
                1. How it works...
                2. There's more...
                  1. Internalizing permissions in subclasses
              3. Securing URLs and protecting against cross-site request forgery
                1. Getting ready
                2. How to do it...
                  1. How it works...
                3. Switching from HTTP to HTTPS and back again
                  1. Getting ready
                  2. How to do it...
                    1. How it works...
                    2. There's more...
                      1. More Info Section 1
      17. 11. Integrating Wicket with Middleware
        1. Introduction
        2. Integrating with Spring
          1. Getting ready
          2. How to do it...
            1. How it works...
            2. There's more...
              1. Injecting non-components
          3. Integrating with CDI
            1. Getting ready
            2. How to do it...
              1. How it works...
              2. There's more...
                1. Injecting non-component classes
            3. Populating repeaters from a JPA query
              1. Getting ready
              2. How to do it...
                1. How it works...
                2. There's more...
                  1. Sorting with IDataProvider
              3. Creating a model for a JPA entity
                1. Getting ready
                2. How to do it...
                  1. How it works...
                  2. There's more...
                    1. Improving entity class resolution
                    2. A simpler data provider