Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL

About this Book

About this Book

Lift is an advanced, next-generation framework for building highly interactive and intuitive web applications. Lift aims to give you a toolkit that scales with both your needs as a developer and the needs of your applications. Lift includes a range of features right out of the box that set it apart from other frameworks in the marketplace: namely security, statefulness, and performance.

Lift also includes a range of high-level abstractions that make day-to-day development easy and powerful. In fact, one of the main driving forces during Lift’s evolution has been to include only features that have an actual production use. You, as the developer, can be sure that the features you find in Lift are distilled from real production code.

Lift in Action is a step-by-step exploration of the Lift web framework, and it’s split into two main parts: chapters 1 through 5 introduce Lift and walk you through building a small, sample application, and then chapters 6 through 15 take a deep dive into the various parts of Lift, providing you with a deep technical reference to help you get the best out of Lift.


Chapter 1 introduces Lift and sets the scene with regard to how it came into existence. It also covers the various modules of the framework to give you an appreciation for the bigger picture.

Chapter 2 shows you how to get up and running with the Scala build tool SBT and start making your first web application with Lift. This chapter focuses on small, incremental steps covering the concepts of development that you’ll need in the rest of the book.

Chapter 3, 4, and 5 walk you through the construction of a real-time auction application to cover as many different parts of Lift as possible. This includes creating templates, connecting to a database, and implementing basic AJAX and Comet.

Chapter 6 takes a dive into the practical aspects of Lift WebKit, showing you how to work with the sophisticated templating system, snippets, and form building through LiftScreen and Wizard. Additionally, this chapter introduces Lift’s own abstraction for handling application state in the form of RequestVar and SessionVar. This chapter concludes with an overview of some useful extension modules, known as widgets, that ship with the Lift distribution.

Chapters 7 focuses on Lift’s SiteMap feature, which allows you to control access and security for particular resources.

Chapter 8 covers the internal working of Lift’s HTTP pipeline, detailing the various hooks that are available and demonstrating several techniques for implementing HTTP services.

Chapter 9 explores Lift’s sophisticated AJAX and Comet support, demonstrating these technologies in practice by assembling a rock-paper-scissors game. This chapter also covers Lift’s AJAX abstraction called wiring, which allows you to build chains of AJAX interaction with ease.

Chapters 10 and 11 cover Lift’s persistence systems, Mapper and Record. Mapper is an active-record style object-relational mapper (ORM) for interacting with SQL data stores, whereas Record is store-agnostic and can be used with any backend system from MySQL to modern NoSQL stores such as MongoDB.

Chapter 12 demonstrates Lift’s localization toolkit for building applications that can work seamlessly in any language. This includes the various ways in which you can hook in your ResourceBundles to store localized content.

Chapter 13 is all about the enterprise aspects often associated with web application development. Technologies such as JPA are prevalent within the enterprise space, and companies often want to reuse them, so this chapter shows you how to implement JPA with Lift. Additionally, this chapter covers messaging using the Akka framework.

Chapter 14 covers testing with Lift and shows you some different strategies for testing snippets. More broadly, it demonstrates how to design code that has a higher degree of decoupling, so your general coding lends itself to testing.

Finally, chapter 15 consolidates all that you’ve read in the book and shows you how to take your application into production. This includes an overview of various servlet containers, a demonstration of implementing distributed state handling, and a guide to monitoring with Twitter Ostrich.

Who should read this book?

Primarily, this book is intended to demonstrate how to get things done using Lift. With this in mind, the book is largely slanted toward users who are new to Lift, but who have experience with other web development frameworks. Lift has its own unique way of doing things, so some of the concepts may seem foreign, but I make conceptual comparisons to things you may be familiar with from other popular frameworks or libraries to smooth the transition.

If you’re coming to Lift with little or no knowledge of Scala, you should know that Lift makes use of many Scala language features. This book includes a Scala rough guide to get you up and running within the context of Lift as quickly as possible.

The book largely assumes that you have familiarity with XML and HTML. Lift’s templating mechanism is 100 percent based on XML, and although it’s straightforward to use, it’s useful to have an understanding of structured XML that makes use of namespaces.

Finally, because Lift is primarily a web framework designed for browser-based experiences, JavaScript is inevitably part of the application toolchain. Lift includes a high-level Scala abstraction for building JavaScript expressions, but having an understanding of JavaScript and client-side scripting can greatly improve your understanding of the client-server interactions supplied by Lift.

Code conventions and examples

This book includes a wide range of examples and code illustrations from Scala code and HTML templates, to plain text configurations for third-party products. Source code in the listings and in the text is presented in a fixed width font to separate it from ordinary text. Additionally, Scala types, methods, keywords, and XML-based markup elements in text are also presented using fixed width font. Where applicable, the code examples explicitly include import statements to clarify which types and members originate from which packages. In addition, functions and methods have explicitly annotated types where the result type is not clear.

Although Scala code is typically quite concise, there are some listings that needed to be reformatted to fit in the available page space in the book. You are encouraged to download the source code from the online repository, in order to see the sample code in its original form ( In addition to some reformatting, all the comments have been removed for brevity. You can also download the code for the examples in the book from the publisher’s website at

Code annotations accompany many of the source code listings, highlighting important concepts. In some cases, numbered bullets link to explanations in the subsequent text.

Lift itself is released under the Apache Software License, version 2.0, and all the source code is available online at the official Github repository ( Reading Lift’s source code can greatly speed your efforts at becoming productive in using Lift for your own applications.

Author Online

Purchase of Lift in Action includes free access to a private web forum run by Manning Publications where you can make comments about the book, ask technical questions, and receive help from the author and from other users. To access the forum and subscribe to it, point your web browser to Action or This page provides information on how to get on the forum once you’re registered, what kind of help is available, and the rules of conduct on the forum.

Manning’s commitment to our readers is to provide a venue where a meaningful dialog between individual readers and between readers and the author can take place. It’s not a commitment to any specific amount of participation on the part of the author, whose contribution to the AO remains voluntary (and unpaid). We suggest you try asking the author some challenging questions lest his interest stray!

The Author Online forum and the archives of previous discussions will be accessible from the publisher’s website as long as the book is in print.

  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint