Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Lift Application Development Cookbook
  • Table Of Contents Toc
Lift Application Development Cookbook

Lift Application Development Cookbook

By : Gilberto Tadeu Garcia Jun
4.4 (7)
close
close
Lift Application Development Cookbook

Lift Application Development Cookbook

4.4 (7)
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)
close
close
Lift Application Development Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1
Index

Validating forms


In the previous recipe, we learned how to create a form so that users can submit data to the server. However, we didn't validate the data, and thus, it allows users to submit anything including invalid data, such as an invalid e-mail address or date.

The reason to validate data submitted by users is not only to prevent the application crashing from being fed data in an invalid format—for example, sending an email to an invalid e-mail address—but also for security reasons.

Getting ready

We are going to improve the code from the previous recipe by adding validation to the form we've created. You can duplicate the project to keep the previous section's code unmodified or you can modify it.

How to do it...

Carry out the following steps to validate the form:

  1. In the SinglePageForm.scala file, add the following import statement:

    import java.util.regex.Pattern
  2. Add the following line in the SinglePageForm snippet:

    val emailRegex = Pattern.compile("\\b[a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\\.[a-zA...
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Lift Application Development Cookbook
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon