Book Image

Lift Application Development Cookbook

By : Gilberto Tadeu Garcia Jun
Book Image

Lift Application Development Cookbook

By: Gilberto Tadeu Garcia Jun

Overview of this book

Developing secure web applications is one of the most important tasks developers have to deal with. With Lift, it is easy to create solid and formidable web applications as it is the most secure web framework available today. The View-First approach and being able to handle things as purely data transformation, makes working with Lift an exciting task. "Lift Application Development Cookbook" teaches you how to build web applications using this amazing framework. The book moves gradually, starting with the basics (starting a new project, submitting a form, and so on) before covering more advanced topics such as building a REST API and integrating your application with other technologies and applications. "Lift Application Development Cookbook" takes you on a journey of creating secure web applications. Step-by-step instructions help you understand how things work and how various elements relate to each other. You'll learn different ways to process a form, build dynamic HTML pages, and create an API using REST. You'll also learn how to work with relational and NoSQL databases and how to integrate your application with other technologies as well as with third-part applications such as Gmail and Facebook. By the end of the book, you will be able to understand how Lift works and be able to build web applications using this amazing and exciting framework.
Table of Contents (15 chapters)
Lift Application Development Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Creating CRUD features with CRUDify


Another interesting feature offered by Lift is the CRUDify trait. Imagine if there was a way to get your mappings and generate all the pages necessary to perform CRUD operations without you having to manually create them one by one. What I am saying is that, given a mapping, your application will automatically have all the pages needed to perform the CRUD operations. Wouldn't it be nice if we had such a feature? Well, it happens that we do have such a feature, as the CRUDify trait does exactly this!

Note

CRUD is an acronym for the four basic functions performed to databases and persistent storage, and it stands for Create, Read, Update, and Destroy.

Getting ready

To demonstrate how the CRUDify trait works, we will use the project we created in the Mapping a table to a Scala class recipe.

You can duplicate it or just modify the same project.

How to do it...

Carry out the following steps:

  1. Mix-in the CRUDify trait in the Contact object as follows:

    object Contact extends...